]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/timegm.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / timegm.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
4 .\"
5 .TH TIMEGM 3 2021-03-22 "Linux man-pages (unreleased)"
6 .SH NAME
7 timegm, timelocal \- inverses of gmtime and localtime
8 .SH LIBRARY
9 Standard C library
10 .RI ( libc ", " \-lc )
11 .SH SYNOPSIS
12 .nf
13 .B #include <time.h>
14 .PP
15 .BI "time_t timelocal(struct tm *" tm );
16 .BI "time_t timegm(struct tm *" tm );
17 .PP
18 .fi
19 .RS -4
20 Feature Test Macro Requirements for glibc (see
21 .BR feature_test_macros (7)):
22 .RE
23 .PP
24 .BR timelocal (),
25 .BR timegm ():
26 .nf
27 Since glibc 2.19:
28 _DEFAULT_SOURCE
29 Glibc 2.19 and earlier:
30 _BSD_SOURCE || _SVID_SOURCE
31 .fi
32 .SH DESCRIPTION
33 The functions
34 .BR timelocal ()
35 and
36 .BR timegm ()
37 are the inverses of
38 .BR localtime (3)
39 and
40 .BR gmtime (3).
41 Both functions take a broken-down time and convert it to calendar time
42 (seconds since the Epoch, 1970-01-01 00:00:00 +0000, UTC).
43 The difference between the two functions is that
44 .BR timelocal ()
45 takes the local timezone into account when doing the conversion, while
46 .BR timegm ()
47 takes the input value to be Coordinated Universal Time (UTC).
48 .SH RETURN VALUE
49 On success,
50 these functions return the calendar time (seconds since the Epoch),
51 expressed as a value of type
52 .IR time_t .
53 On error, they return the value
54 .I (time_t)\ \-1
55 and set
56 .I errno
57 to indicate the error.
58 .SH ERRORS
59 .TP
60 .B EOVERFLOW
61 The result cannot be represented.
62 .SH ATTRIBUTES
63 For an explanation of the terms used in this section, see
64 .BR attributes (7).
65 .ad l
66 .nh
67 .TS
68 allbox;
69 lbx lb lb
70 l l l.
71 Interface Attribute Value
72 T{
73 .BR timelocal (),
74 .BR timegm ()
75 T} Thread safety MT-Safe env locale
76 .TE
77 .hy
78 .ad
79 .sp 1
80 .SH STANDARDS
81 These functions are nonstandard GNU extensions
82 that are also present on the BSDs.
83 .SH NOTES
84 The
85 .BR timelocal ()
86 function is equivalent to the POSIX standard function
87 .BR mktime (3).
88 There is no reason to ever use it.
89 .SH SEE ALSO
90 .BR gmtime (3),
91 .BR localtime (3),
92 .BR mktime (3),
93 .BR tzset (3)