1GMTIME(3P)                 POSIX Programmer's Manual                GMTIME(3P)
2
3
4

PROLOG

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

NAME

12       gmtime, gmtime_r — convert a time value to a broken-down UTC time
13

SYNOPSIS

15       #include <time.h>
16
17       struct tm *gmtime(const time_t *timer);
18       struct tm *gmtime_r(const time_t *restrict timer,
19           struct tm *restrict result);
20

DESCRIPTION

22       For gmtime(): The functionality described on  this  reference  page  is
23       aligned  with the ISO C standard. Any conflict between the requirements
24       described here and the ISO C standard is unintentional. This volume  of
25       POSIX.1‐2017 defers to the ISO C standard.
26
27       The gmtime() function shall convert the time in seconds since the Epoch
28       pointed to by timer into a broken-down time, expressed  as  Coordinated
29       Universal Time (UTC).
30
31       The  relationship  between a time in seconds since the Epoch used as an
32       argument to gmtime() and the tm  structure  (defined  in  the  <time.h>
33       header)  is  that  the  result  shall be as specified in the expression
34       given in the definition of seconds since the Epoch (see the Base  Defi‐
35       nitions volume of POSIX.1‐2017, Section 4.16, Seconds Since the Epoch),
36       where the names in the structure and in the expression correspond.
37
38       The same relationship shall apply for gmtime_r().
39
40       The gmtime() function need not be thread-safe.
41
42       The asctime(),  ctime(),  gmtime(),  and  localtime()  functions  shall
43       return  values  in one of two static objects: a broken-down time struc‐
44       ture and an array of type char.  Execution of any of the functions  may
45       overwrite the information returned in either of these objects by any of
46       the other functions.
47
48       The gmtime_r() function shall convert the time  in  seconds  since  the
49       Epoch  pointed to by timer into a broken-down time expressed as Coordi‐
50       nated Universal Time (UTC).  The broken-down  time  is  stored  in  the
51       structure  referred  to  by result.  The gmtime_r() function shall also
52       return the address of the same structure.
53

RETURN VALUE

55       Upon successful  completion,  the  gmtime()  function  shall  return  a
56       pointer to a struct tm.  If an error is detected, gmtime() shall return
57       a null pointer and set errno to indicate the error.
58
59       Upon successful completion, gmtime_r() shall return the address of  the
60       structure  pointed to by the argument result.  If an error is detected,
61       gmtime_r() shall return a null pointer and set errno  to  indicate  the
62       error.
63

ERRORS

65       The gmtime() and gmtime_r() functions shall fail if:
66
67       EOVERFLOW
68              The result cannot be represented.
69
70       The following sections are informative.
71

EXAMPLES

73       None.
74

APPLICATION USAGE

76       The  gmtime_r()  function  is thread-safe and returns values in a user-
77       supplied buffer instead of possibly using a static data area  that  may
78       be overwritten by each call.
79

RATIONALE

81       None.
82

FUTURE DIRECTIONS

84       None.
85

SEE ALSO

87       asctime(),  clock(),  ctime(), difftime(), localtime(), mktime(), strf‐
88       time(), strptime(), time(), utime()
89
90       The Base Definitions volume  of  POSIX.1‐2017,  Section  4.16,  Seconds
91       Since the Epoch, <time.h>
92
94       Portions  of  this text are reprinted and reproduced in electronic form
95       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
96       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
97       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
98       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
99       event of any discrepancy between this version and the original IEEE and
100       The  Open Group Standard, the original IEEE and The Open Group Standard
101       is the referee document. The original Standard can be  obtained  online
102       at http://www.opengroup.org/unix/online.html .
103
104       Any  typographical  or  formatting  errors that appear in this page are
105       most likely to have been introduced during the conversion of the source
106       files  to  man page format. To report such errors, see https://www.ker
107       nel.org/doc/man-pages/reporting_bugs.html .
108
109
110
111IEEE/The Open Group                  2017                           GMTIME(3P)
Impressum