This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2 10/10] Revise the documentation of simple calendar time.


On Wed, Aug 28, 2019 at 9:09 PM Paul Eggert <eggert@cs.ucla.edu> wrote:
> Zack Weinberg wrote:
> > +This is the simplest function for getting the current calendar time.
> > +It returns the calendar time as a value of type @code{time_t}; on
> > +POSIX systems, that means it has a resolution of one second.  It
> > +uses the same clock as @w{@samp{clock_gettime (CLOCK_REALTIME)}}
> > +and @code{gettimeofday} (see below).
>
> As we've discussed recently (e.g.,
> <https://sourceware.org/ml/libc-alpha/2019-08/msg00755.html>), the 'time'
> function does not necessarily use the same clock as clock_gettime
> (CLOCK_REALTIME).
...
> This function uses a clock close to the clocks of @w{@samp{clock_gettime
> (CLOCK_REALTIME)}} and of @code{gettimeofday} (see below), but the three clocks
> are not necessarily in lock-step, and precise timestamp comparison is reliable
> only when timestamps come from the same clock.

I think it's good to add a cautionary note *like* this, but I'm
worried that your suggested text might confuse readers into thinking
that these clocks might use different epochs or could be set
independently.  I'll think about how to put it better.

zw


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]