Index of Section 3 Manual Pages
| Interix / SUA | tzset.3 | Interix / SUA |
tzset(3) tzset(3)
tzset()
NAME
tzset() - set time-zone and daylight-savings-time variables
SYNOPSIS
#include
extern char *tzname[];
extern long int timezone;
extern int daylight;
void tzset (void)
DESCRIPTION
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:
std offset [dst [offset][, rule]]
Where:
std and dst
Three or more bytes that designate the standard (std) or summer (dst)
time zone. Only std is required; if dst is missing, then summer time
does not apply in this locale. Upper and lowercase letters are
explicitly allowed. Any characters except a leading colon (:), digits,
comma (,), minus (-), plus (+), and ASCII NUL are allowed.
offset
Indicates the value one must add to the local time to arrive at
Coordinated Universal Time. The offset has the form:
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 (+).)
rule
Indicates when to change to and back from summer time. The rule has
the form:
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:
Jn
The Julian day n (1 <= n <= 365). Leap days are not counted; that
is, in all years -- including leap years -- February 28 is day 59
and March 1 is day 60. It is impossible to explicitly refer to the
occasional February 29.
n
The zero-based Julian day (0 <= n <= 365 ) . Leap days are
counted, and it is possible to refer to February 29.
Mm.n.d
The d day (0 <= d <= 6) of week n of month m of the year (1 <= n
<= 5), (1 <= m <= 12), where week 5 means the last d day in month
m which may occur in either the fourth or the fifth week). Week 1
is the first week in which the d day occurs. Day zero is Sunday.
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.
SEE ALSO
date(1)
gettimeofday(3)
ctime(3)
getenv(3)
time(2)
USAGE NOTES
The tzset function is thread safe.
The tzset function is not async-signal safe.