[root@GZMJ_Logic_2 ]# cat lys.cpp
#include "stdio.h"
#include <iostream>
#include<time.h>
#include<stdlib.h>
#include <fstream>
#include <string>
#include<ctime>
using namespace std;
int main ()
{ for( ; ; )
{
time_t timep;
time (&timep);
//printf("%s", ctime(&timep)); //time_t now_time;
//now_time = time(NULL);
usleep(); ofstream ofresult( "game.log",ios::app);
ofstream ofresult_pid( "game.pid",ios::app);
//cout<<"game ok"<<endl;
//ofresult<< ctime(&timep) <<" game "<<" ok "<<endl;
ofresult<< ctime(&timep)<<" game "<<" ok "<<endl;
ofresult_pid<<""<<endl;
//ofresult<<" game "<<" ok "<<endl;
//ofresult<<"[ "<<now_time<<" ]"<<" game "<<" ok "<<endl;
//ofresult<<now_time<<endl;
} }

[root@GZMJ_Logic_2 1]# g++ lys.cpp -o lys
[root@GZMJ_Logic_2 1]# ./lys

c++ 输出时间的更多相关文章

  1. (转)linux 中使用ls指定输出时间格式

    linux 中使用ls指定输出时间格式 原文:http://blog.csdn.net/chaofanwei/article/details/13018753 ls -l --time-style=x ...

  2. Java abstract类的基本使用 和 [abstract类实现]打印1000以内的所有素数并输出时间

    笔记: /** 关键字abstract ,实现抽象类,相当于给出类的大纲,子类只管继承,但抽象类不可被实例化! * 1.抽象方法只保留方法的功能,而具体的执行,交给继承抽象类的子类,由子类重写所有的抽 ...

  3. java中如何按一定的格式输出时间, 必须给出例子

    题目2: 按一定的格式输出时间 import java.util.*;import java.text.SimpleDateFormat;public class Test {    public s ...

  4. struts2 <s:property/>标签的使用--输出时间格式转换

    转载地址http://hi.baidu.com/nonyi_com/blog/item/acf1b8d74b6cf63e07088bc4.html 最近在使用struts2的<s:propert ...

  5. Asp.Net MVC5 格式化输出时间日期

    刚好用到这个,网上找的全部是输出文本框内容的格式化日期时间 而我需要只是在一个表格中的单元个中输出单纯的文字 最后在MSDN上找到 HtmlHelper.FormatValue 方法 public s ...

  6. c++11 输出时间

    C++11中输出当前时间最直接的方法: std::time_t t2 = std::time(nullptr); cout << std::put_time(std::localtime( ...

  7. python的日志模块:logging;django的日志系统;django日志输出时间修改

    Django的log,主要是复用Python标准库中的logging模块,在settings.py中进行配置 源代码 1.__init__.py包含以下类: StreamHandler Formatt ...

  8. tp在页面输出时间

    输出时间戳 :{:time()} 输出当前时间:{:date('Y-m-d H:i:s')} 输出1970的时间:{:date('Y-m-d H:i:s',$vo['create_time'])}

  9. python学习笔记 | strftime()格式化输出时间

    time模块 import time t = time.strftime("%Y-%m-%d %H:%M:%S") print(t) datetime模块 import datet ...

  10. 使用php输出时间格式

    <? date_default_timezone_set("ETC/GMT-8"); $tm=time(); echo date("Y-m-d h:i a" ...

随机推荐

  1. (转载)PHP array_slice() 函数

    (转载)http://www.w3school.com.cn/php/func_array_slice.asp PHP Array 函数 定义和用法 array_slice() 函数在数组中根据条件取 ...

  2. 使用libevent进行多线程socket编程demo

    最近要对一个用libevent写的C/C++项目进行修改,要改成多线程的,故做了一些学习和研究. libevent是一个用C语言写的开源的一个库.它对socket编程里的epoll/select等功能 ...

  3. 深入理解object C中复制对象的用法(一)

    第一.复制对象的基本概念 复制一个对象为副本,开辟一块新的内存来存储副本对象. 第二.如果一个对象想具备复制的功能,必须实现<NSCopying>协议和<NSMutableCopyi ...

  4. 在sql语句中使用plsql变量

    示例代码如下: create or replace type ua_id_table is table of number; declare v_tab ua_id_table;begin v_tab ...

  5. .Hibernate一对一映射与组件映射

    1.按照外键映射(Hibernate提供了两种映射一对一关联关系的方式:按照外键映射和按照主键映射) 实现需要: 创建实体类Users1和Resume1 public class Users1 { p ...

  6. 【科研论文】W5100在远程电力质量监测设备中的应用

    摘要: 针对传统电力质量监测方法实时性.多参数测试性能较差的缺点,提出了将以太网接入技术与电能采集相结合进行电力质量现场和远程在线监测的设计方案.硬件设计采用微控制器STM32FI03和以太网控制芯片 ...

  7. C++获得系统路径

    源码: [cpp] view plaincopy #include <Shlobj.h> #include <stdio.h> #include <locale.h> ...

  8. soundPool和audiofocus

    audiofocus试验: 使用soundPool来写一个播放音频的porject. 资源初始化: setContentView(R.layout.activity_main); Button bt1 ...

  9. UI开发--响应者链条

    一.触摸事件处理的详细过程 用户点击屏幕后产生的一个触摸事件,经过一些列的传递过程后,会找到最合适的视图控件来处理这个事件 找到最合适的视图控件后,就会调用控件的touches方法来作具体的事件处理 ...

  10. automatically select architectures

    各位在用XCode 5.x 打开用XCode 4.x 创建的项目时候.会遇到编译器警告automatically select architectures. 1. This is because th ...