3.2 _daylight, _timezone, _tzname

The _daylight, _timezone, and _tzname variables are global time-zone variables used in time functions.

They are declared in the TIME.H include file as follows:

extern int _daylight;

extern long _timezone;

extern char *_tzname[2];

Some time and date routines use the _daylight, _timezone, and _tzname variables to make local-time adjustments. Whenever a program calls the _ftime, localtime, or _tzset function, the value of _daylight, _timezone, and _tzname is determined from the value of the TZ environment variable. If you do not explicitly set the value of TZ, the default value of “PST8PDT” is used. The following list shows each variable and its value:

Variable Value

_daylight Nonzero if a daylight-saving-time zone (DST) is specified in TZ; otherwise, 0. Default value is 1.
_timezone Difference in seconds between Universal Coordinated Time and the local time. Default value is 28,800.
_tzname[0] Three-letter time-zone name derived from the TZ environment variable. Default value is “PST” (Pacific standard time).
_tzname[1] Three-letter daylight-saving-time-zone name derived from the TZ environment variable. Default value is “PDT” (Pacific daylight time). If the DST zone is omitted from TZ, _tzname[1] is an empty string.