标签:style c class blog code java
#include <stdio.h> #include <sys/time.h> #include <time.h> int gettimeofday(struct timeval*tv,struct timezone *tz); int main(int argc, char* argv[]) { int timeuse; struct timeval starttime,endtime; gettimeofday(&starttime,0); sleep(2); gettimeofday(&endtime,0); timeuse=(endtime.tv_sec-starttime.tv_sec)*1000000+endtime.tv_usec-starttime.tv_usec; timeuse/=1000 ; printf("the programme run %d second/n the result of 1+2+3+....100 \n ",timeuse); printf("Hello World!\n"); return 0; }
获取某个程序运行经历的时间差值.
C --gettimeofday===获取某个程序经历的时间,布布扣,bubuko.com
C --gettimeofday===获取某个程序经历的时间
标签:style c class blog code java
原文地址:http://www.cnblogs.com/aspirant/p/3756694.html