clock(3) non-functional?
Hi,
Looking at libsamplerate test problems, I found that clock(3) used
there is not reliable. Strange results are obtained on too Linux with a
simple test program. Using clock_gettime(2) instead on both Linux and
Hurd works perfectly. The Linux man page for clock(3) says that it is
implemented on top of clock_gettime(2) since glibc 2.18 and later, not
on times(2) as before. Is that true for Hurd too?
The following simple program gives unreliable results both on Linux and
especially Hurd:
clock_t start, end;
double cpu_time_used;
start = clock();
printf("start = %ld\n", start);
sleep(3);
end = clock();
printf("end = %ld\n", end);
cpu_time_used = (double) (end - start) / CLOCKS_PER_SEC;
printf("cpu_time_used = %f\n", cpu_time_used);
Reply to: