tzset()                  Set External Time Variable, Environment Variables
 
 #include   <time.h>
 
 void       tzset(void);
 
    tzset() uses the current setting of the environment variable TZ to
    assign values to three variables: 'daylight', 'timezone', and
    'tzname'.
 
    The value of TZ must be:
 
            a three-letter time zone name (such as EST), followed by
 
            an optional signed number giving 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 name.
 
    "PST8PDT" is 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:    There is no return value.
 
      Notes:    These variables are used by ftime() and localtime() to
                convert from Greenwich mean time to local time.
 
  -------------------------------- 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]);
         }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster