summaryrefslogtreecommitdiffstats
path: root/man2/time.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/time.2')
-rw-r--r--man2/time.247
1 files changed, 22 insertions, 25 deletions
diff --git a/man2/time.2 b/man2/time.2
index f121e9c..5ac0bc4 100644
--- a/man2/time.2
+++ b/man2/time.2
@@ -6,7 +6,7 @@
.\" Modified Sat Jul 24 14:13:40 1993 by Rik Faith <faith@cs.unc.edu>
.\" Additions by Joseph S. Myers <jsm28@cam.ac.uk>, 970909
.\"
-.TH time 2 2023-03-30 "Linux man-pages 6.05.01"
+.TH time 2 2023-11-11 "Linux man-pages 6.7"
.SH NAME
time \- get time in seconds
.SH LIBRARY
@@ -15,14 +15,14 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <time.h>
-.PP
+.P
.BI "time_t time(time_t *_Nullable " tloc );
.fi
.SH DESCRIPTION
.BR time ()
returns the time as the number of seconds since the
Epoch, 1970-01-01 00:00:00 +0000 (UTC).
-.PP
+.P
If
.I tloc
is non-NULL,
@@ -35,6 +35,17 @@ On error, \fI((time_t)\ \-1)\fP is returned, and
is set to indicate the error.
.SH ERRORS
.TP
+.B EOVERFLOW
+The time cannot be represented as a
+.I time_t
+value.
+This can happen if an executable with 32-bit
+.I time_t
+is run on a 64-bit kernel when the time is 2038-01-19 03:14:08 UTC or later.
+However, when the system time is out of
+.I time_t
+range in other situations, the behavior is undefined.
+.TP
.B EFAULT
.I tloc
points outside your accessible address space (but see BUGS).
@@ -60,29 +71,15 @@ in which case they are leap years.
This value is not the same as the actual number of seconds between the time
and the Epoch, because of leap seconds and because system clocks are not
required to be synchronized to a standard reference.
-The intention is that the interpretation of seconds since the Epoch values be
-consistent; see POSIX.1-2008 Rationale A.4.15 for further rationale.
-.PP
-On Linux, a call to
-.BR time ()
-with
-.I tloc
-specified as NULL cannot fail with the error
-.BR EOVERFLOW ,
-even on ABIs where
-.I time_t
-is a signed 32-bit integer and the clock reaches or exceeds 2**31 seconds
-(2038-01-19 03:14:08 UTC, ignoring leap seconds).
-(POSIX.1 permits, but does not require, the
-.B EOVERFLOW
-error in the case where the seconds since the Epoch will not fit in
-.IR time_t .)
-Instead, the behavior on Linux is undefined when the system time is out of the
-.I time_t
-range.
+Linux systems normally follow the POSIX requirement
+that this value ignore leap seconds,
+so that conforming systems interpret it consistently;
+see POSIX.1-2018 Rationale A.4.16.
+.P
Applications intended to run after 2038 should use ABIs with
.I time_t
-wider than 32 bits.
+wider than 32 bits; see
+.BR time_t (3type).
.SS C library/kernel differences
On some architectures, an implementation of
.BR time ()
@@ -101,7 +98,7 @@ successful reports that the time is a few seconds
the Epoch, so the C library wrapper function never sets
.I errno
as a result of this call.
-.PP
+.P
The
.I tloc
argument is obsolescent and should always be NULL in new code.