Go to the previous, next section.

Functions and Variables for Time Zones

Variable: char * tzname [2]

The array tzname contains two strings, which are the standard three-letter names of the pair of time zones (standard and daylight savings) that the user has selected. tzname[0] is the name of the standard time zone (for example, "EST"), and tzname[1] is the name for the time zone when daylight savings time is in use (for example, "EDT"). These correspond to the std and dst strings (respectively) from the TZ environment variable.

The tzname array is initialized from the TZ environment variable whenever tzset, ctime, strftime, mktime, or localtime is called.

Function: void tzset (void)

The tzset function initializes the tzname variable from the value of the TZ environment variable. It is not usually necessary for your program to call this function, because it is called automatically when you use the other time conversion functions that depend on the time zone.

The following variables are defined for compatibility with System V Unix. These variables are set by calling localtime.

Variable: long int timezone

This contains the difference between GMT and local standard time, in seconds. For example, in the U.S. Eastern time zone, the value is 5*60*60.

Variable: int daylight

This variable has a nonzero value if the standard U.S. daylight savings time rules apply.

Go to the previous, next section.