public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Zack Weinberg <zackw@panix.com>, libc-alpha@sourceware.org
Cc: Joseph Myers <joseph@codesourcery.com>,
	Florian Weimer <fweimer@redhat.com>,
	Lukasz Majewski <lukma@denx.de>,
	Alistair Francis <alistair23@gmail.com>,
	Stepan Golosunov <stepan@golosunov.pp.ru>,
	Arnd Bergmann <arnd@arndb.de>,
	Adhemerval Zanella <adhemerval.zanella@linaro.org>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>
Subject: Re: [PATCH v2 10/10] Revise the documentation of simple calendar time.
Date: Thu, 29 Aug 2019 01:09:00 -0000	[thread overview]
Message-ID: <e0d7c756-f285-587a-1756-7a0174f4f8c5@cs.ucla.edu> (raw)
In-Reply-To: <20190828153236.18229-11-zackw@panix.com>

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). On GNU/Linux it appears to use the CLOCK_REALTIME_COARSE 
clock, though I doubt whether that's guaranteed everywhere. So I suggest 
changing that last sentence to:

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.

> +@deftypevr Macro clockid_t CLOCK_REALTIME
> +@standards{POSIX.1, time.h}
> +System-wide clock measuring calendar time.  This clock reports the
> +same time as @code{time} (above) and @code{gettimeofday} (below) and
> +uses the POSIX epoch, 00:00:00 on January 1, 1970, Coordinated
> +Universal Time.

Similarly, change the last sentence to:

This clock uses the POSIX epoch, 00:00:00 on January 1, 1970, Coordinated 
Universal Time. It is close to, but not necessarily in lock-step with, the 
clocks of @code{time} (above) and of @code{gettimeofday} (below).

> +@code{struct timeval}.  @code{gettimeofday} uses the same clock as
> +@code{time} and @w{@samp{clock_gettime (CLOCK_REALTIME)}}.

Similarly, change this sentence to:

The clock of @code{gettimeofday} is close to, but not necessarily in lock-step 
with, the clocks of @code{time} and of @w{@samp{clock_gettime (CLOCK_REALTIME)}} 
(see above).

  reply	other threads:[~2019-08-29  1:09 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 15:32 [PATCH v2 00/10] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions Zack Weinberg
2019-08-28 15:32 ` [PATCH v2 07/10] Use clock_gettime to implement timespec_get Zack Weinberg
2019-09-02 19:25   ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 03/10] Use clock_settime to implement stime; withdraw stime Zack Weinberg
2019-08-30 17:55   ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 10/10] Revise the documentation of simple calendar time Zack Weinberg
2019-08-29  1:09   ` Paul Eggert [this message]
2019-08-29 17:41     ` Zack Weinberg
2019-08-30 19:17       ` Paul Eggert
2019-08-28 15:32 ` [PATCH v2 02/10] Finish move of clock_* functions to libc Zack Weinberg
2019-08-30 17:41   ` Adhemerval Zanella
2019-09-03  7:29   ` Florian Weimer
2019-09-03 13:25     ` Adhemerval Zanella
2019-09-03 13:31       ` Florian Weimer
2019-09-03 13:44         ` Adhemerval Zanella
2019-09-03 14:35           ` Zack Weinberg
2019-09-03 18:50             ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 08/10] Use clock_gettime to implement gettimeofday Zack Weinberg
2019-08-28 18:28   ` Florian Weimer
2019-09-02 19:31     ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 06/10] Use clock_gettime to implement ftime; withdraw ftime Zack Weinberg
2019-09-02 18:42   ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 05/10] Use clock_gettime to implement time Zack Weinberg
2019-08-28 18:16   ` Florian Weimer
2019-08-28 18:36     ` Zack Weinberg
2019-08-28 18:49       ` Florian Weimer
2019-08-28 20:01     ` Paul Eggert
2019-08-28 20:21       ` Florian Weimer
2019-08-28 21:12         ` Paul Eggert
2019-08-28 21:39           ` Florian Weimer
2019-08-29 17:49             ` Zack Weinberg
2019-09-02 13:32               ` Florian Weimer
2019-09-02 18:35                 ` Adhemerval Zanella
2019-08-28 15:32 ` [PATCH v2 01/10] Change most internal uses of __gettimeofday to __clock_gettime Zack Weinberg
2019-08-29 20:30   ` Adhemerval Zanella
2019-08-29 20:42     ` Samuel Thibault
2019-08-28 15:47 ` [PATCH v2 04/10] Use clock_settime to implement settimeofday Zack Weinberg
2019-09-02 13:22   ` Adhemerval Zanella
2019-09-03 14:45     ` Zack Weinberg
2019-08-28 15:47 ` [PATCH v2 09/10] Warn when gettimeofday is called with non-null tzp argument Zack Weinberg
2019-09-03 19:56   ` Adhemerval Zanella
2019-08-28 17:15 ` [PATCH v2 00/10] Y2038 preparation: use clock_[gs]ettime to implement the other time-getting and -setting functions Joseph Myers
2019-09-03 14:43   ` Zack Weinberg
2019-09-10 17:32     ` Adhemerval Zanella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0d7c756-f285-587a-1756-7a0174f4f8c5@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=adhemerval.zanella@linaro.org \
    --cc=alistair23@gmail.com \
    --cc=arnd@arndb.de \
    --cc=fweimer@redhat.com \
    --cc=joseph@codesourcery.com \
    --cc=libc-alpha@sourceware.org \
    --cc=lukma@denx.de \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=stepan@golosunov.pp.ru \
    --cc=zackw@panix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).