To whoever is using the following code for timing code execution in C
Originally Posted by [B]vijayan121 [/B]
#include<time.h>
blah blah
main()
{
clock_t start, end;
double cpu_time_used;
start = clock();
/* whatever */
end = clock();
cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC;
}
if you are wondering why the time displayed is compiler specific instead of being processor specific the solution is here:
Applications should use sysconf(_SC_CLK_TCK) to determine the number of clock ticks per second as it may vary from system to system.
http://www.opengroup.org/onlinepubs/000095399/functions/times.html
http://www.opengroup.org/onlinepubs/000095399/functions/sysconf.html
Courtesy great google and opengroup.org