]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/timegm.3
man3/t-v.3: srcfix: Use a single-font-style macro for a single argument
[thirdparty/man-pages.git] / man3 / timegm.3
1 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
7 .\"
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
12 .\"
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH TIMEGM 3 2016-12-12 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 timegm, timelocal \- inverses of gmtime and localtime
28 .SH SYNOPSIS
29 .nf
30 .B #include <time.h>
31 .PP
32 .BI "time_t timelocal(struct tm *" tm );
33 .PP
34 .BI "time_t timegm(struct tm *" tm );
35 .PP
36 .fi
37 .in -4n
38 Feature Test Macro Requirements for glibc (see
39 .BR feature_test_macros (7)):
40 .in
41 .PP
42 .BR timelocal (),
43 .BR timegm ():
44 Since glibc 2.19:
45 _DEFAULT_SOURCE
46 Glibc 2.19 and earlier:
47 _BSD_SOURCE || _SVID_SOURCE
48 .SH DESCRIPTION
49 The functions
50 .BR timelocal ()
51 and
52 .BR timegm ()
53 are the inverses of
54 .BR localtime (3)
55 and
56 .BR gmtime (3).
57 Both functions take a broken-down time and convert it to calendar time
58 (seconds since the Epoch, 1970-01-01 00:00:00 +0000, UTC).
59 The difference between the two functions is that
60 .BR timelocal ()
61 takes the local timezone into account when doing the conversion, while
62 .BR timegm ()
63 takes the input value to be Coordinated Universal Time (UTC).
64 .SH RETURN VALUE
65 On success,
66 these functions return the calendar time (seconds since the Epoch),
67 expressed as a value of type
68 .IR time_t .
69 On error, they return the value
70 .I (time_t)\ \-1
71 and set
72 .I errno
73 to indicate the cause of the error.
74 .SH ERRORS
75 .TP
76 .B EOVERFLOW
77 The result cannot be represented.
78 .SH ATTRIBUTES
79 For an explanation of the terms used in this section, see
80 .BR attributes (7).
81 .TS
82 allbox;
83 lbw21 lb lb
84 l l l.
85 Interface Attribute Value
86 T{
87 .BR timelocal (),
88 .BR timegm ()
89 T} Thread safety MT-Safe env locale
90 .TE
91 .SH CONFORMING TO
92 These functions are nonstandard GNU extensions
93 that are also present on the BSDs.
94 Avoid their use.
95 .SH NOTES
96 The
97 .BR timelocal ()
98 function is equivalent to the POSIX standard function
99 .BR mktime (3).
100 There is no reason to ever use it.
101 .SH SEE ALSO
102 .BR gmtime (3),
103 .BR localtime (3),
104 .BR mktime (3),
105 .BR tzset (3)