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