windows: Calculates the wall-clock time used by the calling process. return:The elapsed wall-clock time since the start of the process
Linux:The clock() function returns an approximation of processor time used by the program
Windows:
#include <stdio.h>
#include <time.h>
#include <windows.h> int main()
{
printf("The start clock is: %ld\n", clock());
Sleep();
printf("The end clock is: %ld\n", clock()); return ;
}
Linux:
#include <stdio.h>
#include <time.h>
#include <unistd.h> int main()
{
printf("The start clock is: %ld\n", clock());
sleep();
printf("The end clock is: %ld\n", clock()); return ;
}
运行的结果:
Windows:
The start clock is: 1
The end clock is: 2001
Linux:
The start clock is: 0
The end clock is: 0
参考:
http://blog.csdn.net/lxmky/article/details/7026986
http://msdn.microsoft.com/en-us/library/aa272059(v=vs.60).aspx
man clock