public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug manual/31808] New: The supported time_t range is not documented.
@ 2024-05-27 22:57 vincent-srcware at vinc17 dot net
  2024-05-28  0:06 ` [Bug manual/31808] " gabravier at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vincent-srcware at vinc17 dot net @ 2024-05-27 22:57 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=31808

            Bug ID: 31808
           Summary: The supported time_t range is not documented.
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: manual
          Assignee: unassigned at sourceware dot org
          Reporter: vincent-srcware at vinc17 dot net
                CC: mtk.manpages at gmail dot com
  Target Milestone: ---

The ISO C17 standard says about time_t:

  The range and precision of times representable in clock_t and time_t
  are implementation-defined.

The glibc manual says that time_t is an integer, but nothing about the actual
supported range (for positive and negative values):

 -- Data Type: time_t

     ‘time_t’ is the simplest data type used to represent simple
     calendar time.

     In ISO C, ‘time_t’ can be either an integer or a floating-point
     type, and the meaning of ‘time_t’ values is not specified.  The
     only things a strictly conforming program can do with ‘time_t’
     values are: pass them to ‘difftime’ to get the elapsed time between
     two simple calendar times (*note Calculating Elapsed Time::), and
     pass them to the functions that convert them to broken-down time
     (*note Broken-down Time::).

     On POSIX-conformant systems, ‘time_t’ is an integer type and its
     values represent the number of seconds elapsed since the “epoch”,
     which is 00:00:00 on January 1, 1970, Coordinated Universal Time.

     The GNU C Library additionally guarantees that ‘time_t’ is a signed
     type, and that all of its functions operate correctly on negative
     ‘time_t’ values, which are interpreted as times before the epoch.

This is important, because if values > 2^52 are officially supported in
magnitude, the difftime() function would have to round the result, and the
exact behavior is not documented in such a case, e.g. which rounding mode is
used and whether an "inexact" exception may be signaled (with the consequence
that difftime() may not be a pure function, due to a side effect).

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-04 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-27 22:57 [Bug manual/31808] New: The supported time_t range is not documented vincent-srcware at vinc17 dot net
2024-05-28  0:06 ` [Bug manual/31808] " gabravier at gmail dot com
2024-05-28  2:23 ` eggert at cs dot ucla.edu
2024-05-28 17:20 ` eggert at cs dot ucla.edu
2024-05-28 17:21 ` [Bug time/31808] " eggert at cs dot ucla.edu
2024-06-04 16:08 ` eggert at cs dot ucla.edu

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).