1GMTIME(P) POSIX Programmer's Manual GMTIME(P)
2
3
4
6 gmtime, gmtime_r - convert a time value to a broken-down UTC time
7
9 #include <time.h>
10
11 struct tm *gmtime(const time_t *timer);
12
13
14 struct tm *gmtime_r(const time_t *restrict timer,
15 struct tm *restrict result);
16
17
19 For gmtime(): The functionality described on this reference page is
20 aligned with the ISO C standard. Any conflict between the requirements
21 described here and the ISO C standard is unintentional. This volume of
22 IEEE Std 1003.1-2001 defers to the ISO C standard.
23
24 The gmtime() function shall convert the time in seconds since the Epoch
25 pointed to by timer into a broken-down time, expressed as Coordinated
26 Universal Time (UTC).
27
28 The relationship between a time in seconds since the Epoch used as an
29 argument to gmtime() and the tm structure (defined in the <time.h>
30 header) is that the result shall be as specified in the expression
31 given in the definition of seconds since the Epoch (see the Base Defi‐
32 nitions volume of IEEE Std 1003.1-2001, Section 4.14, Seconds Since the
33 Epoch), where the names in the structure and in the expression corre‐
34 spond.
35
36 The same relationship shall apply for gmtime_r().
37
38 The gmtime() function need not be reentrant. A function that is not
39 required to be reentrant is not required to be thread-safe.
40
41 The asctime(), ctime(), gmtime(), and localtime() functions shall
42 return values in one of two static objects: a broken-down time struc‐
43 ture and an array of type char. Execution of any of the functions may
44 overwrite the information returned in either of these objects by any of
45 the other functions.
46
47 The gmtime_r() function shall convert the time in seconds since the
48 Epoch pointed to by timer into a broken-down time expressed as Coordi‐
49 nated Universal Time (UTC). The broken-down time is stored in the
50 structure referred to by result. The gmtime_r() function shall also
51 return the address of the same structure.
52
54 Upon successful completion, the gmtime() function shall return a
55 pointer to a struct tm. If an error is detected, gmtime() shall return
56 a null pointer and set errno to indicate the error.
57
58 Upon successful completion, gmtime_r() shall return the address of the
59 structure pointed to by the argument result. If an error is detected,
60 gmtime_r() shall return a null pointer.
61
63 The gmtime() function shall fail if:
64
65 EOVERFLOW
66 The result cannot be represented.
67
68
69 The following sections are informative.
70
72 None.
73
75 The gmtime_r() function is thread-safe and returns values in a user-
76 supplied buffer instead of possibly using a static data area that may
77 be overwritten by each call.
78
80 None.
81
83 None.
84
86 asctime() , clock() , ctime() , difftime() , localtime() , mktime() ,
87 strftime() , strptime() , time() , utime() , the Base Definitions vol‐
88 ume of IEEE Std 1003.1-2001, <time.h>
89
91 Portions of this text are reprinted and reproduced in electronic form
92 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
93 -- Portable Operating System Interface (POSIX), The Open Group Base
94 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
95 Electrical and Electronics Engineers, Inc and The Open Group. In the
96 event of any discrepancy between this version and the original IEEE and
97 The Open Group Standard, the original IEEE and The Open Group Standard
98 is the referee document. The original Standard can be obtained online
99 at http://www.opengroup.org/unix/online.html .
100
101
102
103IEEE/The Open Group 2003 GMTIME(P)