]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/timegm.3
locale.1, localedef.1, _exit.2, accept.2, access.2, acct.2, adjtimex.2, bdflush.2...
[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-03-15 "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 .sp
32 .BI "time_t timelocal(struct tm *" tm );
33 .sp
34 .BI "time_t timegm(struct tm *" tm );
35 .sp
36 .fi
37 .in -4n
38 Feature Test Macro Requirements for glibc (see
39 .BR feature_test_macros (7)):
40 .in
41 .sp
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 ATTRIBUTES
65 For an explanation of the terms used in this section, see
66 .BR attributes (7).
67 .TS
68 allbox;
69 lbw21 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 .SH CONFORMING TO
78 These functions are nonstandard GNU extensions
79 that are also present on the BSDs.
80 Avoid their use.
81 .SH NOTES
82 The
83 .BR timelocal ()
84 function is equivalent to the POSIX standard function
85 .BR mktime (3).
86 There is no reason to ever use it.
87 .SH SEE ALSO
88 .BR gmtime (3),
89 .BR localtime (3),
90 .BR mktime (3),
91 .BR tzset (3)