现在的位置: 首页 > 综合 > 正文

记录和打印时间

2013年01月01日 ⁄ 综合 ⁄ 共 351字 ⁄ 字号 评论关闭

std::string get_timer()

{

char szTmp[64] = {0};

struct timeval tv;

gettimeofday(&tv, NULL);

struct tm tmNow;

localtime_r(&tv.tv_sec, &tmNow);

strftime(szTmp,sizeof(szTmp), "[%Y-%m-%d %H:%M:%S]", &tmNow);

//strftime(szTmp,64,"%H:%M:%S",&ptm);

return temp;

}

原文

http://blog.csdn.net/maocl1983/article/details/6221810

http://www.cnblogs.com/mydomain/archive/2011/09/04/2166577.html

抱歉!评论已关闭.