GMTIME(3)                  POSIX Programmer's Manual                 GMTIME(3)



PPRROOLLOOGG
       This manual page is part of the POSIX Programmer's Manual.  The OS
       implementation of this interface may differ (consult the corresponding
       OS manual page for details of OS behavior), or the interface may not be
       implemented on OS.

NNAAMMEE
       gmtime, gmtime_r -- convert a time value to a broken-down UTC time

SSYYNNOOPPSSIISS
       #include <time.h>

       struct tm *gmtime(const time_t *_t_i_m_e_r);
       struct tm *gmtime_r(const time_t *restrict _t_i_m_e_r,
           struct tm *restrict _r_e_s_u_l_t);

DDEESSCCRRIIPPTTIIOONN
       For _g_m_t_i_m_e(): The functionality described on this reference page is
       aligned with the ISO C standard. Any conflict between the requirements
       described here and the ISO C standard is unintentional. This volume of
       POSIX.1-2017 defers to the ISO C standard.

       The _g_m_t_i_m_e() function shall convert the time in seconds since the Epoch
       pointed to by _t_i_m_e_r into a broken-down time, expressed as Coordinated
       Universal Time (UTC).

       The relationship between a time in seconds since the Epoch used as an
       argument to _g_m_t_i_m_e() and the ttmm structure (defined in the _<_t_i_m_e_._h_>
       header) is that the result shall be as specified in the expression
       given in the definition of seconds since the Epoch (see the Base
       Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _4_._1_6, _S_e_c_o_n_d_s _S_i_n_c_e _t_h_e
       _E_p_o_c_h), where the names in the structure and in the expression
       correspond.

       The same relationship shall apply for _g_m_t_i_m_e___r().

       The _g_m_t_i_m_e() function need not be thread-safe.

       The _a_s_c_t_i_m_e(), _c_t_i_m_e(), _g_m_t_i_m_e(), and _l_o_c_a_l_t_i_m_e() functions shall
       return values in one of two static objects: a broken-down time
       structure and an array of type cchhaarr.  Execution of any of the functions
       may overwrite the information returned in either of these objects by
       any of the other functions.

       The _g_m_t_i_m_e___r() function shall convert the time in seconds since the
       Epoch pointed to by _t_i_m_e_r into a broken-down time expressed as
       Coordinated Universal Time (UTC).  The broken-down time is stored in
       the structure referred to by _r_e_s_u_l_t.  The _g_m_t_i_m_e___r() function shall
       also return the address of the same structure.

RREETTUURRNN VVAALLUUEE
       Upon successful completion, the _g_m_t_i_m_e() function shall return a
       pointer to a ssttrruucctt ttmm.  If an error is detected, _g_m_t_i_m_e() shall return
       a null pointer and set _e_r_r_n_o to indicate the error.

       Upon successful completion, _g_m_t_i_m_e___r() shall return the address of the
       structure pointed to by the argument _r_e_s_u_l_t.  If an error is detected,
       _g_m_t_i_m_e___r() shall return a null pointer and set _e_r_r_n_o to indicate the
       error.

EERRRROORRSS
       The _g_m_t_i_m_e() and _g_m_t_i_m_e___r() functions shall fail if:

       EEOOVVEERRFFLLOOWW
              The result cannot be represented.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       None.

AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       The _g_m_t_i_m_e___r() function is thread-safe and returns values in a user-
       supplied buffer instead of possibly using a static data area that may
       be overwritten by each call.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _a_s_c_t_i_m_e(), _c_l_o_c_k(), _c_t_i_m_e(), _d_i_f_f_t_i_m_e(), _l_o_c_a_l_t_i_m_e(), _m_k_t_i_m_e(),
       _s_t_r_f_t_i_m_e(), _s_t_r_p_t_i_m_e(), _t_i_m_e(), _u_t_i_m_e()

       The Base Definitions volume of POSIX.1-2017, _S_e_c_t_i_o_n _4_._1_6, _S_e_c_o_n_d_s
       _S_i_n_c_e _t_h_e _E_p_o_c_h, <<ttiimmee..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                            GMTIME(3)
