Thanks for your help but i wont be working in a Unix environment, I am running my code in windows.
Is there a different method that I could use?
Thanks
you can use function clock() in <time.h> to measure the elapsed time since program startup, e.g. to measure elapsed time for a section of code
-
time_t start_time = clock(); /* get start time */
-
........ code to measure
-
float time1 = (float) (clock() - start_time) / CLOCKS_PER_SEC;
-
printf("time for code was %f seconds\n", time1);
-
the actual CPU time could well be different depending upon the number of processes running, etc