lthread icon indicating copy to clipboard operation
lthread copied to clipboard

Should use monotonic clock instead of gettimeofday

Open baruch opened this issue 10 years ago • 0 comments

The result of gettimeofday is the wall clock which can change backwards in some occassions (time drifted and ntp re-enabled). In that case timeouts may not expire for a while until the wall clock catches up.

It is better to use CLOCK_MONOTONIC with clock_gettime() to get a stable clock that never moves backwards.

baruch avatar Mar 22 '15 09:03 baruch