set time conversion information 



#include <time.h>

void tzset(void);

extern char *tzname[];

extern long int timezone;

extern int daylight;


The tzset() function sets time conversion information used by localtime(), ctime(), strftime(), mktime() and related functions. The time conversion information is taken from the following sources:

As part of its processing, the tzset() function loads the external variable tzname[0] with a pointer to a null-terminated character string containing the name of the local standard time. If the local time has a defined alternative, or "Daylight Savings" time, the external variable tzname[1] is loaded with a pointer to the name of the local alternative time. Otherwise, the variable is loaded with a pointer to an empty string. The time zone name strings are no greater than TZNAME_MAX bytes in length.

The tzset() function also sets the external variable daylight to zero if Daylight Savings Time conversion should never be applied for the time zone in use; and non-zero otherwise. The external variable timezone is set to the difference, in seconds, between Coordinated Universal Time (UTC) and the local standard time.

Format Rules for TZ

Two formats are supported for the TZ variable:


STD is the name of the local standard time, offset is the value that one must add to local time to get the current UTC, and DST is the optional name for the local alternative time. An optional offset can be defined for DST; if none is given, then it is assumed to be an hour less than the STDoffset. The optional dstrules specify the dates and times of transition between standard time and daylight savings time for the process. If transition rules are not specified but DST is defined, then the current host settings for transition dates and times are applied.

The syntax for local time offset is


That is, an offset is expressed as a one or two digit hour amount, optionally preceded by a sign, and optionally followed by minutes and by seconds.

The syntax for dstrules is


The value start specifies the local date at which daylight savings time begins, while the value end specifies the local date at which standard time is resumed. The optional times of transition have the same syntax as offsets, with the exception that they may not be signed. If present, transition times are in the current local time. Note in particular that the transition to standard time is specified as a daylight time.

Transition dates are in one of three formats:


Julian day n (1 <= n <= 365), not allowing leap years. That is, J59 is always February 28 and J60 is always March 1st. It is impossible to explicitly refer to the occasional leap year.


Julian day n (0 <= n <= 365), allowing leap years. For ngreater than 58, the month and day of the month that correspond to n depend upon whether or not the year is a leap year.


Month m (January is 1), week w (1st is 1, 2nd is 2, last is 5) day of the week d (Sunday is 0). For example, M4.1.0 is the first Sunday in April, M10.5.2 is the last Tuesday in October.


The literal value of string is used to identify a time zone setting from the registry. If no key called string is in the registry, then time zone information is obtained from the current host settings.






UNIX 98, with exceptions.




If the literal format for TZ variable is used, then the NuTCRACKER Platform gets the process' time zone settings from the registry. Time zone entries can be edited by use of the tzedit utility, which is part of the NT resource kit.

The setting format for TZ that the NuTCRACKER Platform recognizes is a broader definition than that used by the Windows C runtime library. Because of this, when mixing NuTCRACKER Platform and Win32 code (for example, an MFC-based GUI using a NuTCRACKER Platform DLL), setting a NuTCRACKER Platform-format TZ in the environment can result in the Windows native code failing to parse the time zone information. To avoid a conflict in the environment, the _NutTzSet() function can be used to establish a time zone setting that does not interfere with Windows code for use by functions in the PTC MKS Toolkit UNIX APIs.


PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


_NutTzGet(), _NutTzSet(), asctime(), asctime_r(), ctime(), ctime_r(), localtime(), localtime_r(), mktime(), strftime(), wcsftime()

PTC MKS Toolkit 10.3 Documentation Build 39.