[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. 【转】android 4.3 BLE onCharacteristicWrite没有回调

    原文网址:http://bbs.csdn.net/topics/390882717?page=1 问题1.我在自己程序有开一个Timer定时去readCharacteristic, 每次read可以成 ...

  2. HBase HFile

    HFile index HFile index, which is proportional to the total number of Data Blocks. The total amount ...

  3. winform调用WCF默认实例

    一:截图 二:调用代码 using System; using System.Collections.Generic; using System.ComponentModel; using Syste ...

  4. DateTime用法二

    任何项目,难免会碰到DateTime的显示问题,.net框架虽提供丰富多样的显示方法,但我很少使用,因老忘记细节,每次都要纠结到底月份在前还是年份在前:日期分隔符到底是“/”,还是“\”,还是“-”等 ...

  5. 关于Android API的理解

    举个例子: 比如程序中用到了android.content.ClipboardManager这个类, 而该类是在API 11才添加到 “库”. (原谅我,不理解Google API 文档里的 adde ...

  6. 逆向思维Stock Maximize

    题目出处 题目描述: 这个题的意思是: 给出一段时间内 某个股票的每天的价格 每天可以进行的操作有:买一股,卖掉所有股,不作为 问在给定的序列里怎样让价值最大 数据规模: 每组数据包含case数 T( ...

  7. L1签证_百度百科

    L1签证_百度百科 L1签证

  8. Drainage Ditches - poj 1273(网络流模板)

    题意:1是源点,m是汇点,求出来最大流量,没什么好说的就是练习最大流的模板题 ************************************************************* ...

  9. SAE 搭建 WordPress

    WordPress,是国外一款使用PHP语言开发的开源博客平台,用户可以在支持PHP和MySQL 数据库的服务器上架设自己的博客站点,也可以把 WordPress 当作一个内容管理系统(CMS)来使用 ...

  10. fedorea19安装redis

    Redis 安装: $ wget http://redis.googlecode.com/files/redis-2.4.5.tar.gz $ tar xzf redis-2.4.5.tar.gz $ ...