1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| #include <stdio.h> #include <sys/timeb.h> long long getSystemTime() { struct timeb t; ftime(&t); return 1000 * t.time + t.millitm; } int main() { long long start=getSystemTime(); sleep(3); long long end=getSystemTime(); printf("time: %lld ms\n", end-start); return 0; }
|