The functions gmtime()
and gmtime64()
interpret the time specification of the value to which clock
points as the number of seconds that have elapsed since 1.1.1970 00:00:00 hrs UTC (epoch). Such a value is returned for example by the functions time()
and time64()
. gmtime()
and gmtime64()
calculate from this the date and time in UTC and store it in a type tm structure. Negative values are interpreted as seconds before the epoch. The following points in time are considered invalid:
- with
gmtime()
points in time before 13.12.1901 20:45:52 hrs UTC and after 19.01.2038 03:14:07 Uhr UTC - with
gmtime64()
points in time before 1.1.1900 00:00:00 hrs UTC and after 31.12.9999 23:59:59 hrs UTC.
The declarations of all functions, external values, and of the tm
structure are contained in the header time.h
. The tm
structure is defined as follows:
struct tm {
int tm_sec; /* Seconds - [0, 61] for skipped seconds */
int tm_min; /* Minutes - [0, 59] */
int tm_hour; /* Hours - [0, 23] */
int tm_mday; /* Day of month - [1, 31] */
int tm_mon; /* Months - [0, 11] */
int tm_year; /* Years since 1900 */
int tm_wday; /* Days since Sunday - [0, 6] */
int tm_yday; /* Days since January - [0, 365] */
int tm_isdst; /* Option for daylight saving time (always 0) */
};
BS2000
gmtime()
interprets the time specification of type time_t
as the number of seconds that have elapsed since January 1, 1970, 00:00:00 local time. From this number, gmtime()
calculates the date and time and stores the result in a structure of type tm.
In this implementation, gmtime()
is equivalent to localtime()
; both functions return the local time. (End)
gmtime()
is not thread-safe. Use the reentrant function gmtime_r()
when needed.