I am trying to measure the execution time of a code block in C. I have something like this in my code:
clock_t begin, end;
double time_spent;
begin = clock();
AT
clock usually has very poor resolution, on the order of 10 milliseconds. This is most likely your problem. If you're on a POSIX system, use clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock to get a high-resolution result. Other types of systems probably have system-specific ways to achieve the same.