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:
[:]<std><std_offset>[<dst>[<dst_offset>][,<sdate>[/<stime>] ,<edate>[/<etime>]]]
Where:
[:] |
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.
| ||||
<std> <dst> |
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. | ||||
<std_offset> <dst_offset> <stime> <etime> |
These parameters have the following format: [+|-]<hours>[:<minutes>[:<seconds>]] The default is 2:00:00. | ||||
<sdate> <edate> |
DST start date and DST end date have the format: <julian0>|J<julian1>|M<month>.<week>.<day> Where:
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. |
None.
Versions | Defined in | Include | Link to |
---|---|---|---|
INtime 3.0 | intime/rt/include/time.h | time.h | clib.lib |
asctime, getenv, gmtime, localtime, putenv, time, time macros