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

From: Paul Davis <paul@email-addr-hidden>
Date: Thu May 05 2011 - 03:20:51 EEST

On Wed, May 4, 2011 at 7:11 PM, Tim E. Real <termtech@email-addr-hidden> wrote:
> 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.

i believe you want CLOCK_REALTIME. however, if CLOCK_MONOTONIC is
malfunctioning and you can prove it with a very small piece of code,
the kernel guys will want to know.

> 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.

gettimeofday() is subject to system time corrections (e.g. via NTP).
it is never ever guaranteed to be monotonic.
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Thu May 5 04:15:01 2011

This archive was generated by hypermail 2.1.8 : Thu May 05 2011 - 04:15:01 EEST