标签:style blog color ar div sp log amp on
测试机器处理效率,或者做效率优化的适合:
1 #include <time.h> 2 #include <sys/time.h> 3 void getCurrentTime(char* buf) 4 { 5 struct timeval tv; 6 7 struct timezone tz; 8 9 struct tm *p; 10 11 gettimeofday(&tv,&tz); 12 13 p = localtime(&tv.tv_sec); 14 15 sprintf(buf,"time_now:%d-%d-%d %d:%d:%d.%ld\n", 1900+p->tm_year, 1+p->tm_mon, p->tm_mday, p->tm_hour, p->tm_min, p->tm_sec, tv.tv_usec/1000); 16 }
标签:style blog color ar div sp log amp on
原文地址:http://www.cnblogs.com/cy568searchx/p/3951874.html