Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <time.h>
    void tzset( void );

Description:
    The tzset function sets the global variables  daylight,  timezone and
     tzname according to the value of the  TZ environment variable.  The
    section The TZ Environment Variable describes how to set this variable.

    Under Windows NT, tzset also uses operating system supplied time zone
    information.  The  TZ environment variable can be used to override this
    information.

    The global variables have the following values after tzset is executed:

    daylight
        Zero indicates that daylight saving time is not supported in the
        locale; a non-zero value indicates that daylight saving time is
        supported in the locale.  This variable is cleared/set after a call
        to the tzset function depending on whether a daylight saving time
        abbreviation is specified in the  TZ environment variable.

    timezone
        Contains the number of seconds that the local time zone is earlier
        than Coordinated Universal Time (UTC) (formerly known as Greenwich
        Mean Time (GMT)).

    tzname
        Two-element array pointing to strings giving the abbreviations for
        the name of the time zone when standard and daylight saving time are
        in effect.

    The time set on the computer with the DOS time command and the DOS date
    command reflects the local time.  The environment variable TZ is used to
    establish the time zone to which this local time applies.  See the
    section The TZ Environment Variable for a discussion of how to set the
    time zone.

Returns:
    The function does not return a value.

See Also:
    ctime Functions, localtime Functions, mktime, strftime

Example:
    #include <stdio.h>
    #include <env.h>
    #include <time.h>

    void print_zone()
      {
        char *tz;

        printf( "TZ: %s\n", (tz = getenv( "TZ" ))
                        ? tz : "default EST5EDT" );
        printf( "  daylight: %d\n", daylight );
        printf( "  timezone: %ld\n", timezone );
        printf( "  time zone names: %s %s\n",
                tzname[0], tzname[1] );
      }

    void main()
      {
        print_zone();
        setenv( "TZ", "PST8PDT", 1 );
        tzset();
        print_zone();
      }

    produces the following:

    TZ: default EST5EDT
      daylight: 1
      timezone: 18000
      time zone names: EST EDT
    TZ: PST8PDT
      daylight: 1
      timezone: 28800
      time zone names: PST PDT

Classification:
    POSIX 1003.1

Systems:
    All

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson