[PATCH] time: Use CLOCK_REALTIME for time (BZ #30200)
Paul Eggert
eggert@cs.ucla.edu
Wed Mar 8 23:08:48 GMT 2023
On 3/8/23 00:59, Florian Weimer wrote:
> Even if the same underlying clock is used, rounding may cause interface
> which use different precision for the fractional seconds part to report
> different integral seconds. The standard does not require rounding
> towards minus infinity.
Actually, POSIX does require rounding timestamps towards minus infinity
for file timestamps, in its spec for utimensat. This requirement was put
in because some implementations played fast and loose with these
timestamps, with some rounding up and some rounding down, and this
confusion caused more trouble than it was worth.
Perhaps it would help if POSIX had a similar requirement for the 'time'
function, as my impression from this discussion is that the confusion
with 'time' being out-of-sync with CLOCK_REALTIME is also more trouble
than it's worth.
Anyway, thanks for clarifying what Glibc does.
More information about the Libc-alpha
mailing list