]>
Commit | Line | Data |
---|---|---|
fea681da MK |
1 | .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl> |
2 | .\" | |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
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. | |
c13182ef | 12 | .\" |
fea681da MK |
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. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
fea681da | 24 | .\" |
35deeb87 | 25 | .TH TIMEGM 3 2016-12-12 "GNU" "Linux Programmer's Manual" |
fea681da | 26 | .SH NAME |
02011a43 | 27 | timegm, timelocal \- inverses of gmtime and localtime |
fea681da MK |
28 | .SH SYNOPSIS |
29 | .nf | |
30 | .B #include <time.h> | |
68e4db0a | 31 | .PP |
b9f02710 | 32 | .BI "time_t timelocal(struct tm *" tm ); |
68e4db0a | 33 | .PP |
b9f02710 | 34 | .BI "time_t timegm(struct tm *" tm ); |
68e4db0a | 35 | .PP |
cc4615cc MK |
36 | .fi |
37 | .in -4n | |
38 | Feature Test Macro Requirements for glibc (see | |
39 | .BR feature_test_macros (7)): | |
40 | .in | |
68e4db0a | 41 | .PP |
cc4615cc MK |
42 | .BR timelocal (), |
43 | .BR timegm (): | |
51c612fb MK |
44 | Since glibc 2.19: |
45 | _DEFAULT_SOURCE | |
46 | Glibc 2.19 and earlier: | |
47 | _BSD_SOURCE || _SVID_SOURCE | |
fea681da MK |
48 | .SH DESCRIPTION |
49 | The functions | |
63aa9df0 | 50 | .BR timelocal () |
fea681da | 51 | and |
63aa9df0 | 52 | .BR timegm () |
02011a43 | 53 | are the inverses of |
fea681da MK |
54 | .BR localtime (3) |
55 | and | |
56 | .BR gmtime (3). | |
501934a9 MK |
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). | |
3bd58712 MK |
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 | |
d8a86e74 | 70 | .I (time_t)\ \-1 |
3bd58712 MK |
71 | and set |
72 | .I errno | |
73 | to indicate the cause of the error. | |
1946f1d2 MK |
74 | .SH ERRORS |
75 | .TP | |
76 | .B EOVERFLOW | |
1b9d5819 | 77 | The result cannot be represented. |
cd6fe8e7 PH |
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 | |
47297adb | 91 | .SH CONFORMING TO |
c8f2dd47 | 92 | These functions are nonstandard GNU extensions |
02011a43 | 93 | that are also present on the BSDs. |
25a0440e | 94 | Avoid their use. |
fea681da | 95 | .SH NOTES |
fea681da | 96 | The |
63aa9df0 | 97 | .BR timelocal () |
fea681da MK |
98 | function is equivalent to the POSIX standard function |
99 | .BR mktime (3). | |
100 | There is no reason to ever use it. | |
47297adb | 101 | .SH SEE ALSO |
fea681da MK |
102 | .BR gmtime (3), |
103 | .BR localtime (3), | |
104 | .BR mktime (3), | |
105 | .BR tzset (3) |