Index of Section 3 Manual Pages
| Interix / SUA | localtime_r.3 | Interix / SUA |
localtime_r(3) localtime_r(3)
localtime()
NAME
localtime(), localtime_r() - transform timer data into timer structure in
local time
SYNOPSIS
#include
struct tm * localtime (const time_t *clock)
struct tm *localtime_r (const time_t *clock,
struct tm *result)
DESCRIPTION
The localtime(3) function takes as an argument a time value representing
the time in seconds since the Epoch (00:00:00 UTC, January 1, 1970; see
time(2)). It converts the time value pointed at by clock, and returns a
pointer to a struct tm (described below) which contains the broken-out
time information for the value after adjusting for the current time zone
(and any other factors such as Daylight Saving Time). Time zone
adjustments are performed as specified by the TZ environment variable (see
tzset(3)). The function localtime(3) uses tzset(3) to initialize time
conversion information if tzset(3) has not already been called by the
process.
After filling in the tm structure, localtime(3) sets the tm_isdst element
of tzname to a pointer to an ASCII string that's the time zone
abbreviation to be used with localtime(3)'s return value.
External declarations as well as the tm structure definition are in the
include file. The tm structure includes at least the following
fields:
int tm_sec; seconds (0 - 60)
int tm_min; minutes (0 - 59)
int tm_hour; hours (0 - 23)
int tm_mday; day of month (1 - 31)
int tm_mon; month of year (0 - 11)
int tm_year; year - 1900
int tm_wday; day of week (Sunday = 0)
int tm_yday; day of year (0 - 365)
int tm_isdst; is summer time in effect?
The field tm_isdst is non-zero if summer time is in effect.
The reentrant localtime_r(3) function converts the time in seconds since
the Epoch pointed to by clock into a broken-down time and stores the
broken-down time in the structure identified by result. On success, the
localtime_r(3) function also returns the address of the same structure;
otherwise, it returns a null pointer.
SEE ALSO
date(1)
asctime(3)
ctime(3)
gmtime(3)
mktime(3)
difftime(3)
getenv(3)
time(2)
tzset(3)
USAGE NOTES
The localtime_r function is thread safe. The localtime function is not
thread safe.
None of these functions are async-signal safe.