- 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....
reference:http://bytes.com/topic/c/answers/576635-there-timer-function-c