/* Using clock() to time an operation. I believe that clock() counts 60ths of a second of CPU time, but it may be 64ths. I'll keep trying to find out. */ #include #include main() { clock_t startTime, elapsedTime; int i, j; startTime = clock(); for( i=0; i < 1000; i++ ) for( j= 0; j < 10000; j++ ) ; elapsedTime = clock() - startTime; printf( "Elapsed time in seconds: %.2f\n", (float)elapsedTime/60 ); }