Description
The functions localtime()
and localtime64()
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
localtime()
points in time before 13.12.1901 20:45:52 hrs UTC and after 19.01.2038 03:14:07 Uhr UTC - with
localtime64()
points in time before 1.1.1900 00:00:00 hrs UTC and after 31.12.9999 23:59:59 hrs UTC.
The local time zone information is used as if the tzset
function has been called.
The localtime()
function corrects for the timezone and any seasonal time adjustments.
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 */
};
tm_isdst
is positive if daylight saving time is set, null if daylight saving time is not set, and negative if the information is not available.
localtime()
is not thread-safe. Use the reentrant function localtime_r()
when needed.
BS2000 localtime()
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, localtime()
calculates the date and time and stores the result in a structure of type tm.
In this implementation, localtime()
is equivalent to gmtime()
; both functions return the local time. (End)