记录和打印时间

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

posted @ 2013-04-16 02:24  浪里飞  阅读(435)  评论(0编辑  收藏  举报