[PATCH 2/2] Improve doc for time_t range (BZ 31808)

DJ Delorie dj@redhat.com
Mon Jun 3 23:39:49 GMT 2024


Paul Eggert <eggert@cs.ucla.edu> writes:
> -In ISO C, @code{time_t} can be either an integer or a floating-point
> +In ISO C, @code{time_t} can be either an integer or a real floating

Ok.

>  On POSIX-conformant systems, @code{time_t} is an integer type and its
>  values represent the number of seconds elapsed since the @dfn{epoch},
>  which is 00:00:00 on January 1, 1970, Coordinated Universal Time.
> +The count of seconds ignores leap seconds.

Does this mean the value is not corrected for leap seconds, or that leap
seconds are part of the hh:mm:ss <-> time_t conversion so no further
worry about leap seconds exists?  I would think "elapsed seconds"
pre-determines whether artificial calendar/time adjustments are included
and/or applied.  I.e. I'm not sure what benefit to the reader this
statement is supposed to provide, perhaps adding ", so you don't have
to..." to clarify it?

>  @Theglibc{} additionally guarantees that @code{time_t} is a signed
>  type, and that all of its functions operate correctly on negative
>  @code{time_t} values, which are interpreted as times before the epoch.
> +Functions like @code{localtime} assume the Gregorian calendar even
> +though this is historically inaccurate for timestamps before the
> +calendar was introduced or after the calendar will become obsolete.

Ok.

>  @cindex epoch
> +@Theglibc{} also supports leap seconds as an option, in which case
> +@code{time_t} counts leap seconds instead of ignoring them.

This contradicts the addition above.  Perhaps that sentence belongs here
(or this, there) with a note about how this affects programs?

> +Currently the @code{time_t} type is 64 bits wide on all platforms
> +supported by @theglibc{}, except that it is 32 bits wide on a few
> +older platforms unless you define @code{_TIME_BITS} to 64.
> +@xref{Feature Test Macros}.
>  @end deftp

Ok.  It might flow better to swap this chunk with the calendar chunk,
though, and have the calendar chunk as a separate paragraph.



More information about the Libc-alpha mailing list