tzset() - set time-zone and daylight-savings-time variables
#include <time.h>
extern char *tzname[];
extern long int timezone;
extern int daylight;
void tzset (void)
The tzset(3) function uses the value of the TZ environment variable to set the time conversion information used by the library routines localtime(3), ctime(3), strftime(3), and mktime(3). It also sets the external variables tzname, timezone, and daylight:
extern char *tzname[2] = { "std","dst"};
extern long int timezone;
extern int daylight;
where std and dst have the same meaning as in the
TZ specification (see below).
The timezone variable contains the difference (in seconds) between Universal Coordinated Time (UTC) and local time. The daylight variable is non-zero when daylight savings time is in effect.
The value of TZ has the following syntax (spaces inserted for clarity):
std offset [ dst [ offset ] [ rule ] ]
Where:
:
), digits, comma
,
), minus -),
plus +
), and
ASCII NUL are allowed.
hh [ : mm [: ss ] ]
The minutes mm and seconds ss are optional. The hour hh is required and may be a single digit. The offset following std is required. If no offset follows dst summer time is assumed to be one hour ahead of standard time. One or more digits may be used; the value is always interpreted as a decimal number. The hour must be between zero and 24, and the minutes (and seconds) if present between zero and 59. If preceded by a (-) the time zone shall be east of the Prime Meridian; otherwise it shall be west (which may be indicated by an optional preceding (+).)
date / time , date / time
where the first date describes when the change from standard to summer time occurs and the second date describes when the change back happens. Each time field describes when, in current local time, the change to the other time is made.
The format of date is one of the following:
The time has the same format as offset except that no leading sign (-) or (+) is allowed. The default, if time is not given, is 02:00:00.
For compatibility with System V Release 3.1, a semicolon (;) can be used to separate the rule from the rest of the specification.
If the TZ variable is absent from the environment, it defaults to the local Windows system's timezone settings.
date(1)
gettimeofday(3)
ctime(3)
getenv(3)
time(2)