Re: latency error (~2ms) with nanosleep

Eric Piel
2005-06-13T14:28:17Z

06/13/2005 04:21 PM, Richard B. Johnson wrote/a écrit:
>
> nanosleep, according to the documation is supposed to sleep
> "at least" the 'struct timespec' time. It can return in
> a shorter time as a result of a signal and, if so, the
> input time-values will be updated accordingly. The resolution
> is limited to the HZ value. This means that it will, unless
> interrupted, always sleep at least 1 / HZ seconds (about 1 ms
> on current x86 distributions).
>
> FYI, there is no 'fine resolution' timer available on any
> Linux-ported platform that could take advantage of the nanosecond
> input resolution of the function.
>
I could add that there is a project working on this issue:
high-resolution timers . You can download patches for 2.6 and 2.4 . The
precision is in the order of 10 or 100 µs.

Eric