localtime()

NAME

localtime() - transform timer data into timer structure in local time

SYNOPSIS

#include <time.h>

struct tm * localtime (const time_t *clock)

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(1) to initialize time conversion information if tzset(1) 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 <time.h> 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.

SEE ALSO

date(1)

asctime(3)

ctime(3)

gmtime(3)

mktime(3)

difftime(3)

getenv(3)

time(2)

tzset(3)