[LAD] Strange gettimeofday behaviour - out of order times.

Tim E. Real termtech at rogers.com
Wed May 4 23:11:59 UTC 2011

I discovered gettimeofday occasionally gives me a time value
 which is less than a previous time value. The value is actually
 'out of order' and really belongs ahead of a few others,
 according to examined printouts.

So I tried  clock_gettime(CLOCK_MONOTONIC, ..), same result.

Then I tried  clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ..)
 and it appears to be OK so far, giving me what I want - truly linear time.

Still checking some things, maybe there's a reason, the app's fault.
From what I've read gettimeofday is thread safe, but the incorrect
 time values are being read by the same thread always.

Any advice here, anyone seen this?

Also, when using Jack, is it advisable to choose the same
 clock method as Jack is using (cycle, hpet, system)?

Thanks. Tim.

More information about the Linux-audio-dev mailing list