标签:获取微妙函数
#include <stdio.h> #include <time.h> #include <sys/time.h> #include <string.h> #include <iostream> using namespace std; char *GetTime(char *pszTime) { char szTempTime[222] = {0}; time_t t = time(NULL); struct tm * Local = localtime(&t); struct timeval tvTime; gettimeofday(&tvTime, NULL); //sprintf(szTempTime,"%02d %02d:%02d:%02d:%06d",Local->tm_mday,Local->tm_hour,Local-> tm_min,Local->tm_sec,tvTime.tv_usec); sprintf(pszTime,"%d",tvTime.tv_usec); printf("---v_s=[%s]\n",pszTime); return pszTime; } int main() { char szTime[20]; memset(szTime,0x00,sizeof(szTime)); printf("获取的 微妙=[%s]\n",GetTime(szTime)); return 0; }
标签:获取微妙函数
原文地址:http://ayang.blog.51cto.com/4224455/1652810