/* * gmtime.c * Original Author: G. Haley * * Converts the calendar time pointed to by tim_p into a broken-down time * expressed as Greenwich Mean Time (GMT). Returns a pointer to a structure * containing the broken-down time, or a null pointer if GMT is not * available. */ /* FUNCTION <>---convert time to UTC traditional form INDEX gmtime INDEX gmtime_r SYNOPSIS #include struct tm *gmtime(const time_t *<[clock]>); struct tm *gmtime_r(const time_t *<[clock]>, struct tm *<[res]>); DESCRIPTION <> takes the time at <[clock]> representing the number of elapsed seconds since 00:00:00 on January 1, 1970, Universal Coordinated Time (UTC, also known in some countries as GMT, Greenwich Mean time) and converts it to a <> representation. <> constructs the traditional time representation in static storage; each call to <> or <> will overwrite the information generated by previous calls to either function. RETURNS A pointer to the traditional time representation (<>). PORTABILITY ANSI C requires <>. <> requires no supporting OS subroutines. */ #include #include #define _GMT_OFFSET 0 #ifdef _REENT_THREAD_LOCAL _Thread_local struct __tm _tls_localtime_buf; #endif #ifndef _REENT_ONLY struct tm * gmtime (const time_t * tim_p) { struct _reent *reent = _REENT; _REENT_CHECK_TM(reent); return gmtime_r (tim_p, (struct tm *)_REENT_TM(reent)); } #endif