#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,);
sleep();
gettimeofday(&endtime,);
timeuse=(endtime.tv_sec-starttime.tv_sec)*+endtime.tv_usec-starttime.tv_usec;
timeuse/= ;
printf("the programme run %d second/n the result of 1+2+3+....100 \n ",timeuse);
printf("Hello World!\n");
return ;
}
获取某个程序运行经历的时间差值.