# gmtime

## PROLOG



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


## NAME



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


## SYNOPSIS



           #include <time.h>
    
           struct tm *gmtime(const time_t *_timer_);
           struct tm *gmtime_r(const time_t *restrict _timer_ ,
               struct tm *restrict _result_);
    


## DESCRIPTION



           For _gmtime_(): 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 _gmtime_() function shall convert the time in seconds since the
           Epoch pointed to by _timer_ 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 _gmtime_() and the **tm** structure (defined in the
           _< time.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, _Section 4.16_ , _Seconds_
           _Since the Epoch_), where the names in the structure and in the
           expression correspond.
    
           The same relationship shall apply for _gmtime_r_().
    
           The _gmtime_() function need not be thread-safe.
    
           The _asctime_(), _ctime_(), _gmtime_(), and _localtime_() functions shall
           return values in one of two static objects: a broken-down time
           structure and an array of type **char**.  Execution of any of the
           functions may overwrite the information returned in either of
           these objects by any of the other functions.
    
           The _gmtime_r_() function shall convert the time in seconds since
           the Epoch pointed to by _timer_ into a broken-down time expressed as
           Coordinated Universal Time (UTC).  The broken-down time is stored
           in the structure referred to by _result_.  The _gmtime_r_() function
           shall also return the address of the same structure.
    


## RETURN VALUE



           Upon successful completion, the _gmtime_() function shall return a
           pointer to a **struct tm**.  If an error is detected, _gmtime_() shall
           return a null pointer and set _errno_ to indicate the error.
    
           Upon successful completion, _gmtime_r_() shall return the address of
           the structure pointed to by the argument _result_.  If an error is
           detected, _gmtime_r_() shall return a null pointer and set _errno_ to
           indicate the error.
    


## ERRORS



           The _gmtime_() and _gmtime_r_() functions shall fail if:
    
           **EOVERFLOW**
                  The result cannot be represented.
    
           _The following sections are informative._
    


## EXAMPLES



           None.
    


## APPLICATION USAGE



           The _gmtime_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.
    


## RATIONALE



           None.
    


## FUTURE DIRECTIONS



           None.
    


* * *