This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

<time.h> clock() HARD FAULT

Trying to see how much time my code consumes, I tried the naive approach, calling clock() in the beginning and at the end and comparing the values.

But when I include clock() on my code, it just breaks. The function wasn't even called. Why is that?

The code I'm trying:

clock_t begin, end;

begin = clock();
time_consuming_task();
end = clock();

printf("%f ms \n", ((float)(end - begin)) /16000000);
Related