用于写日志的时间格式
#include "stdafx.h" #include <time.h> int _tmain(int argc, _TCHAR* argv[]) { TCHAR szTime[32]; memset(szTime, 0, sizeof(szTime)); tm *gmt; time_t osTime= time(0); gmt = localtime(&osTime); _stprintf ( szTime ,"[%d.%02d.%02d_%02d:%02d:%02d]" , gmt->tm_year+1900, gmt->tm_mon+1, gmt->tm_mday, gmt->tm_hour, gmt->tm_min, gmt->tm_sec ); return 0; }