1 .\" Copyright (c) 1992 Drew Eckhardt (drew@cs.colorado.edu), March 28, 1992
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" Modified by Michael Haardt <michael@moria.de>
6 .\" Modified Sat Jul 24 14:13:40 1993 by Rik Faith <faith@cs.unc.edu>
7 .\" Additions by Joseph S. Myers <jsm28@cam.ac.uk>, 970909
9 .TH TIME 2 2021-03-22 "Linux man-pages (unreleased)" "Linux Programmer's Manual"
11 time \- get time in seconds
14 .RI ( libc ", " \-lc )
19 .BI "time_t time(time_t *" tloc );
23 returns the time as the number of seconds since the
24 Epoch, 1970-01-01 00:00:00 +0000 (UTC).
29 the return value is also stored in the memory pointed to by
32 On success, the value of time in seconds since the Epoch is returned.
33 On error, \fI((time_t)\ \-1)\fP is returned, and
35 is set to indicate the error.
40 points outside your accessible address space (but see BUGS).
42 On systems where the C library
44 wrapper function invokes an implementation provided by the
46 (so that there is no trap into the kernel),
47 an invalid address may instead trigger a
51 SVr4, 4.3BSD, C89, C99, POSIX.1-2001.
52 .\" Under 4.3BSD, this call is obsoleted by
53 .\" .BR gettimeofday (2).
54 POSIX does not specify any error conditions.
57 .I seconds since the Epoch
58 using a formula that approximates the number of seconds between a
59 specified time and the Epoch.
60 This formula takes account of the facts that
61 all years that are evenly divisible by 4 are leap years,
62 but years that are evenly divisible by 100 are not leap years
63 unless they are also evenly divisible by 400,
64 in which case they are leap years.
65 This value is not the same as the actual number of seconds between the time
66 and the Epoch, because of leap seconds and because system clocks are not
67 required to be synchronized to a standard reference.
68 The intention is that the interpretation of seconds since the Epoch values be
69 consistent; see POSIX.1-2008 Rationale A.4.15 for further rationale.
75 specified as NULL cannot fail with the error
79 is a signed 32-bit integer and the clock reaches or exceeds 2**31 seconds
80 (2038-01-19 03:14:08 UTC, ignoring leap seconds).
81 (POSIX.1 permits, but does not require, the
83 error in the case where the seconds since the Epoch will not fit in
85 Instead, the behavior on Linux is undefined when the system time is out of the
88 Applications intended to run after 2038 should use ABIs with
92 Error returns from this system call are indistinguishable from
93 successful reports that the time is a few seconds
95 the Epoch, so the C library wrapper function never sets
97 as a result of this call.
101 argument is obsolescent and should always be NULL in new code.
104 is NULL, the call cannot fail.
106 .SS C library/kernel differences
107 On some architectures, an implementation of
113 .BR gettimeofday (2),