Calculate the elapsed time
Windows SDK uses DWORD GetTickCount() functions to calculate a elapsed time between 2 points. DWORD start = GetTickCount(); //Do some work Sleep( 10 ); DWORD end = GetTickCount(); DWORD elapsed = end - start; Linux way of calculating Using gettimeofday function is the most general method. #include <stdio.h> // for printf() #include <sys/time.h> // for clock_gettime() #include <unistd.h> // for usleep() int main () { struct timeval start, end; long secs_used,micros_used; gettimeofday( & start, NULL); usleep( 1250000 ); // Do the stuff you want to time here gettimeofday( & end, NULL); printf( "start: %ld secs, %ld usecs \n " ,start.tv_sec,start.tv_usec); printf( "end: %ld secs, %ld usecs \n " ,end.tv_sec,end.tv_usec); secs_used = (end.tv_sec - start.tv_sec); //avoid overflow by subtracting first micros_used = ((secs_used * 1000000 ) + end.tv_usec)...