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 *clock, struct tm *result);

DESCRIPTION

The gmtime() function converts the time in seconds since the Epoch pointed to by timer into a broken-down time, expressed as Coordinated Universal Time (UTC).

The gmtime() interface need not be reentrant.

The gmtime_r() function converts the calendar time pointed to by clock 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 also returns the address of the same structure.

RETURN VALUE

The gmtime() function returns a pointer to a struct tm.

Upon successful completion, gmtime_r() returns the address of the structure pointed to by the argument result. If an error is detected, or UTC is not available, gmtime_r() returns a NULL pointer.

ERRORS

No errors are defined.

EXAMPLES

None.

APPLICATION USAGE

The asctime(), ctime(), gmtime() and localtime() functions return values in one of two static objects: a broken-down time structure and an array of char. Execution of any of the functions may overwrite the information returned in either of these objects by any of the other functions.

FUTURE DIRECTIONS

None.

SEE ALSO

asctime(), clock(), ctime(), difftime(), localtime(), mktime(), strftime(), strptime(), time(), utime(), <time.h>.

DERIVATION

gmtime() derived from Issue 1 of the SVID.

gmtime_r() derived from the POSIX Threads Extension (1003.1c-1995).