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