INtime SDK Help
tzset (stdio)

Sets the time environment variables.

#include <time.h>

void tzset (void);

int daylight /* Global variables set by function */
long timezone;
char *tzname[2]


This function calls getenv to obtain the current setting of the environment variable TZ, then assigns values to three global variables: daylight, timezone, and tzname. localtime uses these variables to make corrections from GMT to local time, and time uses these variables to compute GMT from system time.

The TZ environment variable has the following syntax:



[:] indicates how the system clock is set. If a semi-colon is present, the time is set to Local Time. No semi-colon indicates that the POSIX-compliant setting of Universal Constant Time (UCT) is used.
Local Time Functions will not need to do shifts for timezone, but will not shift for daylight savings time. The user must reset the system clock twice a year by hand to account for these. All RT file timestamps and CUSPs report the local time.
UCT Functions will automatically handle timezone shifts and daylight savings time switches. All RT file timestamps are in UCT. The RT date/time CUSPs report in UCT even though the system says Local Time.
Standard Time and Daylight Savings Time are _POSIX_TZNAME_MAX in length and are typically a three-character string of the form xST or xDT, such as PST.

These parameters have the following format:


The default is 2:00:00.


DST start date and DST end date have the format:



<julian0> is 0 to 365
<julian1> is 1 to 366
<month> is 1 to 12
<week> is 1 to 5 where 5 is the last week of the month
<day> is 0 (Sunday) to 6 (Saturday)

The default is implementation-specific (U.S. law since 1987 states "M4.1.0" and M10.5.0").

These values are assigned to the variables daylight, timezone, and tzname when tzset is called:

Variable Value and description
daylight Indicates whether daylight savings time is observed locally (1) or not (0). To check the state of this variable, call localtime and see if the tm_isdst field is 1 or 0.
timezone Seconds west of UCT if positive or seconds east of UCT if negative.
tzname[0] String value of the timezone name from the TZ setting; default is PST.
tzname[1] String value of the daylight savings time name; default is PDT. An empty string must appear if daylight savings time is never in effect, as in certain states and localities.

Return Values



Versions Defined in Include Link to
INtime 3.0 intime/rt/include/time.h time.h clib.lib

See Also

asctime, getenv, gmtime, localtime, putenv, time, time macros