Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>tzset() set external time and environment variables</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 tzset()                 Set External Time and Environment Variables

 #include   <time.h>

 void       tzset(void);

    tzset() assigns values to the time-related variables 'daylight',
    'timezone', and 'tzname' by using the current setting of the
    environment variable TZ.

    The value of TZ must be:

            a three-letter abbreviation for a time zone (such as
            EST), followed by

            a number (optionally signed) that gives the difference in
            hours between Greenwich mean time and the local time
            zone, and,

            if daylight saving time is in effect, a three-letter
            daylight saving time abbreviation.

    "PST8PDT" is thus a valid TZ value for the Pacific time zone and is
    the default value if TZ has not been set.   When TZ is set, three
    other environment variables are automatically set:

            'timezone'      The difference in seconds between Greenwich
                            mean time and local time

            'daylight'      Nonzero value if daylight saving time is
                            specified by TZ; otherwise 0

            'tzname[0]'     The string value of the three-letter time
                            zone name specified by TZ

            'tzname[1]'     The string value of daylight saving time
                            zone, or an empty string if daylight saving
                            time zone was omitted from the TZ setting

    Returns:    no return value.

      Notes:    ftime() and localtime() use these variables to convert
                from Greenwich mean time to local time.

 Portability:   Not supported by ANSI standard.

   -------------------------------- Example ---------------------------------

    The following statements set the environment variable TZ to Eastern
    Standard Time, with a 5 hour difference between Greenwich time and
    local time, and then prints out the environment variables set by
    tzset().

           #include <time.h>

           int daylight;
           long timezone;
           char *tzname[];

           main()
           {
               putenv("TZ=EST5");
               tzset();
               printf("Daylight: %d, timezone: %ld, tzname: %s\n",
                       daylight,timezone,tzname[0]);
           }


See Also: ftime() localtime() asctime()

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