I suggest using the POSIX function clock_gettime:
#include <time.h>
timespec real_startTime;
timespec real_endTime;
if(clock_gettime(CLOCK_REALTIME, &real_startTime) != 0)
{
perror("Error on fetching the start-time");
exit(EXIT_FAILURE);
}
if(clock_gettime(CLOCK_REALTIME, &real_endTime) != 0)
{
perror("Error on fetching the end-time");
exit(EXIT_FAILURE);
}
double real_runTime = (real_endTime.tv_sec + real_endTime.tv_nsec / 1000.0 / 1000.0 / 1000.0) - (real_startTime.tv_sec + real_startTime.tv_nsec / 1000.0 / 1000.0 / 1000.0);
, , "" , - ( - ..), clock, .
Excerp clock_gettime man:
, CLOCK_REALTIME. .
Excerp clock man:
clock() .
EDIT:
, - ( 0 10), , - , , I/O ..).