1GMTIME(3P) POSIX Programmer's Manual GMTIME(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 gmtime, gmtime_r — convert a time value to a broken-down UTC time
14
16 #include <time.h>
17
18 struct tm *gmtime(const time_t *timer);
19 struct tm *gmtime_r(const time_t *restrict timer,
20 struct tm *restrict result);
21
23 For gmtime(): The functionality described on this reference page is
24 aligned with the ISO C standard. Any conflict between the requirements
25 described here and the ISO C standard is unintentional. This volume of
26 POSIX.1‐2008 defers to the ISO C standard.
27
28 The gmtime() function shall convert the time in seconds since the Epoch
29 pointed to by timer into a broken-down time, expressed as Coordinated
30 Universal Time (UTC).
31
32 The relationship between a time in seconds since the Epoch used as an
33 argument to gmtime() and the tm structure (defined in the <time.h>
34 header) is that the result shall be as specified in the expression
35 given in the definition of seconds since the Epoch (see the Base Defi‐
36 nitions volume of POSIX.1‐2008, Section 4.15, Seconds Since the Epoch),
37 where the names in the structure and in the expression correspond.
38
39 The same relationship shall apply for gmtime_r().
40
41 The gmtime() function need not be thread-safe.
42
43 The asctime(), ctime(), gmtime(), and localtime() functions shall
44 return values in one of two static objects: a broken-down time struc‐
45 ture and an array of type char. Execution of any of the functions may
46 overwrite the information returned in either of these objects by any of
47 the other functions.
48
49 The gmtime_r() function shall convert the time in seconds since the
50 Epoch pointed to by timer into a broken-down time expressed as Coordi‐
51 nated Universal Time (UTC). The broken-down time is stored in the
52 structure referred to by result. The gmtime_r() function shall also
53 return the address of the same structure.
54
56 Upon successful completion, the gmtime() function shall return a
57 pointer to a struct tm. If an error is detected, gmtime() shall return
58 a null pointer and set errno to indicate the error.
59
60 Upon successful completion, gmtime_r() shall return the address of the
61 structure pointed to by the argument result. If an error is detected,
62 gmtime_r() shall return a null pointer and set errno to indicate the
63 error.
64
66 The gmtime() and gmtime_r() functions shall fail if:
67
68 EOVERFLOW
69 The result cannot be represented.
70
71 The following sections are informative.
72
74 None.
75
77 The gmtime_r() function is thread-safe and returns values in a user-
78 supplied buffer instead of possibly using a static data area that may
79 be overwritten by each call.
80
82 None.
83
85 None.
86
88 asctime(), clock(), ctime(), difftime(), localtime(), mktime(), strf‐
89 time(), strptime(), time(), utime()
90
91 The Base Definitions volume of POSIX.1‐2008, Section 4.15, Seconds
92 Since the Epoch, <time.h>
93
95 Portions of this text are reprinted and reproduced in electronic form
96 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
97 -- Portable Operating System Interface (POSIX), The Open Group Base
98 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
99 cal and Electronics Engineers, Inc and The Open Group. (This is
100 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
101 event of any discrepancy between this version and the original IEEE and
102 The Open Group Standard, the original IEEE and The Open Group Standard
103 is the referee document. The original Standard can be obtained online
104 at http://www.unix.org/online.html .
105
106 Any typographical or formatting errors that appear in this page are
107 most likely to have been introduced during the conversion of the source
108 files to man page format. To report such errors, see https://www.ker‐
109 nel.org/doc/man-pages/reporting_bugs.html .
110
111
112
113IEEE/The Open Group 2013 GMTIME(3P)