[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. bzoj3574[Hnoi2014]抄卡组

    http://www.lydsy.com/JudgeOnline/problem.php?id=3574 我们发现如果所有的字符串都有*,那么只需要比较他们的“前缀”和“后缀”相同即可.“前缀”指第一 ...

  2. jQuery deferred学习笔记

    简介 在jQuery1.5.0版本引入,为了实现Deferred对象,jQuery改写了ajax.是由jQuery.Deferred()方法创建的链式对象. $.Deferred在jQuery代码自身 ...

  3. Letter Combinations of a Phone Number——LeetCode

    Given a digit string, return all possible letter combinations that the number could represent. A map ...

  4. 报错:Failed to create BuildConfig class

    1. Project | Clean| Build Automatically 2. 在目录中找到gen目录,手动删除(一般是没有写权限导致Failed),再执行第一步方案.

  5. 基于wax的lua IOS插件开发

    作者:朱克锋 邮箱:zhukefeng@iboxpay.com 转载请注明出处:http://blog.csdn.net/linux_zkf Objective-C的运行时支持新增类型和方法,但是由于 ...

  6. Json对象直接存取数据库

    需要jar包: json.jar jackson-core.jar jacson-mapper.jar 一.ArrayList转json和hashmap转json代码一样 /**  * 把map转换成 ...

  7. Linux 下安装包制作

    一 Linux安装文件 Linux常见的安装为tar,zip,gz,rpm,deb,bin等.我们可以简单的分为三类, 第一:打包或压缩文件tar,zip,gz等,一般解压后即可,或者解压后运行sh文 ...

  8. Garbage Collectors - Serial vs. Parallel vs. CMS vs. G1 (and what's new in Java 8)--转

    The 4 Java Garbage Collectors - How the Wrong Choice Dramatically Impacts Performance The year is 20 ...

  9. 在Mac中安装.Net Core的开发环境

    在mac中部署dotnet core开发环境,我的MacOS版本号为OSX EI Capitan 10.11.6 1.安装brew homebrew官网推荐的安装命令如下: /usr/bin/ruby ...

  10. [转] PostgreSQL学习手册(数据表)

    from: http://www.cnblogs.com/stephen-liu74/archive/2012/04/23/2290803.html 一.表的定义: 对于任何一种关系型数据库而言,表都 ...