获取当前时间字符串

//get current time string
char szTime[32] = {0};
time_t lTM = time(NULL);
tm *pstTM = localtime(&lTM);
strftime(szTime, 32, "%Y-%m-%d %H:%M:%S", pstTM);

//struct timeval_a old;
struct timeval_a now,interval;
gettimeofday_a(&now,0); 		
timersub(&now,&old,&interval);
float fCost= (static_cast<float>(interval.tv_sec))*1000 + (static_cast<float>(interval.tv_usec))/1000;

 

你可能感兴趣的:(当前时间)