Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
daylight, timezone, tzname
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Variable: daylight, timezone, tzname
Include: <time.h>
Syntax: int daylight;
long timezone;
char * tzname [2];
The daylight, timezone, and tzname variables are used by several
of the time and date functions to make local-time adjustments.
They are declared in the include file TIME.H. The values of the
variables are determined by the setting of an environment variable
named TZ.
The following values are assigned to the daylight, timezone, and
tzname variables when tzset is called:
Variable Value
daylight Nonzero value if a daylight-saving-time zone is
specified in the TZ setting; otherwise, 0
timezone The difference in seconds between GMT and local time
tzname[0] The string value of the three-letter time-zone name
from the TZ setting
tzname[1] The string value of the daylight-saving-time zone,
or an empty string if the daylight-saving-time zone
is omitted from the TZ setting
When you call the ftime or localtime function, the values of these
three variables are determined from the TZ setting. The daylight
variable is given a nonzero value if a DST zone is present in the
TZ setting; otherwise, daylight is 0.
The timezone variable is assigned the difference in seconds
(calculated by converting the hours given in the TZ setting)
between Greenwich mean time and local time. The first element of
the tzname variable is the string value of the three-letter time
zone from the TZ setting; the second element is the string value
of the DST zone. If the DST zone is omitted from the TZ setting,
tzname[1] is an empty string.
The ftime and localtime functions call another function, tzset, to
assign values to the three global variables from the TZ setting.
You can also call tzset directly if you like; for details, see
tzset.