c++ 输出时间
[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++ 输出时间的更多相关文章
- (转)linux 中使用ls指定输出时间格式
linux 中使用ls指定输出时间格式 原文:http://blog.csdn.net/chaofanwei/article/details/13018753 ls -l --time-style=x ...
- Java abstract类的基本使用 和 [abstract类实现]打印1000以内的所有素数并输出时间
笔记: /** 关键字abstract ,实现抽象类,相当于给出类的大纲,子类只管继承,但抽象类不可被实例化! * 1.抽象方法只保留方法的功能,而具体的执行,交给继承抽象类的子类,由子类重写所有的抽 ...
- java中如何按一定的格式输出时间, 必须给出例子
题目2: 按一定的格式输出时间 import java.util.*;import java.text.SimpleDateFormat;public class Test { public s ...
- struts2 <s:property/>标签的使用--输出时间格式转换
转载地址http://hi.baidu.com/nonyi_com/blog/item/acf1b8d74b6cf63e07088bc4.html 最近在使用struts2的<s:propert ...
- Asp.Net MVC5 格式化输出时间日期
刚好用到这个,网上找的全部是输出文本框内容的格式化日期时间 而我需要只是在一个表格中的单元个中输出单纯的文字 最后在MSDN上找到 HtmlHelper.FormatValue 方法 public s ...
- c++11 输出时间
C++11中输出当前时间最直接的方法: std::time_t t2 = std::time(nullptr); cout << std::put_time(std::localtime( ...
- python的日志模块:logging;django的日志系统;django日志输出时间修改
Django的log,主要是复用Python标准库中的logging模块,在settings.py中进行配置 源代码 1.__init__.py包含以下类: StreamHandler Formatt ...
- tp在页面输出时间
输出时间戳 :{:time()} 输出当前时间:{:date('Y-m-d H:i:s')} 输出1970的时间:{:date('Y-m-d H:i:s',$vo['create_time'])}
- python学习笔记 | strftime()格式化输出时间
time模块 import time t = time.strftime("%Y-%m-%d %H:%M:%S") print(t) datetime模块 import datet ...
- 使用php输出时间格式
<? date_default_timezone_set("ETC/GMT-8"); $tm=time(); echo date("Y-m-d h:i a" ...
随机推荐
- python队列join
如果要让一个任务队列按照顺序进行,则必须使用join,代码如下: ''' Created on Dec 23, 2013 @author: long ''' import threading from ...
- Scala 编程(二)类和对象
类,字段和方法 类是对象的蓝图.一旦定义了类,就可以用关键字new从类的蓝图里创建对象,类的定义: class ChecksumAccumulator { // class definition go ...
- Ubuntu下配置smb服务器
一. samba的安装: sudo apt-get insall samba 二. 创建共享目录: mkdir /home/user/share sodu chmod 777 /home/user/s ...
- 定时执行程序-Quartz简单实例
1.加jar包:Quartz自己quartz-1.8.3.jar和依赖包commons-logging.jar .slf4j-log4j12-1.5.10.jar .slf4j-api-1.5.10 ...
- motan源码分析一:服务发布及注册
motan是新浪微博开源的服务治理框架,具体介绍请看:http://tech.sina.com.cn/i/2016-05-10/doc-ifxryhhh1869879.shtml. 本系列的文章将分析 ...
- leetCode 48.Rotate Image (旋转图像) 解题思路和方法
Rotate Image You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees ...
- Injecting and Binding Objects to Spring MVC Controllers--转
I have written two previous posts on how to inject custom, non Spring specific objects into the requ ...
- Linux之make 、makefile的使用方法
◊make是什么? make是一个命令工具,是一个解释makefile中指令的命令工具.它可以简化编译过程里面所下达的指令,当执行 make 时,make 会在当前的目录下搜寻 Makefile (o ...
- 对相同id的input框的循环判断
$("input[id=sl]").each(function(){ alert(10); });
- 更加详细的Log4net的配置
请转到周金桥的文章 http://blog.csdn.net/zhoufoxcn/article/details/6029021