clock函数学习链接
http://blog.csdn.net/roma823/article/details/6403573
下面这篇文章讨论clock_t与time_t的区别
http://www.cnblogs.com/chenyadong/archive/2011/12/03/2274783.html
但是我这个代码在VC下与他的结果不同
#include<stdio.h> #include<stdlib.h> #include<time.h> #include<windows.h> int main(){ clock_t clock_start,clock_end; time_t time_start,time_end; time(&time_start); Sleep(5000); time(&time_end); printf("%f\n",difftime(time_end,time_start)); clock_start=clock(); Sleep(5000); clock_end=clock(); printf("%f\n",(double)(clock_end-clock_start)/CLOCKS_PER_SEC); return 0; }