[PATCH v2 05/10] Use clock_gettime to implement time.
Florian Weimer
fweimer@redhat.com
Wed Aug 28 20:21:00 GMT 2019
* Paul Eggert:
> Florian Weimer wrote:
>> Given that time has no stringent accuracy requirements, this shouldn't
>> come as a surprise.
>
> In what sense does 'time' have less-stringent accuracy requirements
> than clock_gettime (CLOCK_REALTIME) does? Can 'time' return a value
> that disagrees with the time_t part of what clock_gettime
> (CLOCK_REALTIME) returns? Any such disagreement would cause
> application bugs that could well be unlikely and hard to track down;
> also, if there is disagreement, replacing calls to 'time' with calls
> to clock_gettime might not be advisable even aside from performance
> issues.
Maybe accuracy is the wrong word. But time can definitely return the
value of a variable that is incremented periodically from the timer
interrupt. That's not possible for gettimeofday or clock_gettime with
CLOCK_REALTIME (from a quality-of-implementation perspective).
Thanks,
Florian
More information about the Libc-alpha
mailing list