# tzset

## PROLOG



           This manual page is part of the POSIX Programmer's Manual.  The
           Linux implementation of this interface may differ (consult the
           corresponding Linux manual page for details of Linux behavior), or
           the interface may not be implemented on Linux.
    


## NAME



           daylight, timezone, tzname, tzset — set timezone conversion
           information
    


## SYNOPSIS



           #include <time.h>
    
           extern int daylight;
           extern long timezone;
           extern char *tzname[2];
           void tzset(void);
    


## DESCRIPTION



           The _tzset_() function shall use the value of the environment
           variable _TZ_ to set time conversion information used by ctime(3p),
           localtime(3p), mktime(3p), and strftime(3p).  If _TZ_ is absent from
           the environment, implementation-defined default timezone
           information shall be used.
    
           The _tzset_() function shall set the external variable _tzname_ as
           follows:
    
               tzname[0] = "_std_ ";
               tzname[1] = "_dst_ ";
    
           where _std_ and _dst_ are as described in the Base Definitions volume
           of POSIX.1‐2017, _Chapter 8_ , _Environment Variables_.
    
           The _tzset_() function also shall set the external variable _daylight_
           to 0 if Daylight Savings Time conversions should never be applied
           for the timezone in use; otherwise, non-zero. The external
           variable _timezone_ shall be set to the difference, in seconds,
           between Coordinated Universal Time (UTC) and local standard time.
    
           If a thread accesses _tzname_ , _daylight_ , or _timezone_ directly while
           another thread is in a call to _tzset_(), or to any function that is
           required or allowed to set timezone information as if by calling
           _tzset_(), the behavior is undefined.
    


## RETURN VALUE



           The _tzset_() function shall not return a value.
    


## ERRORS



           No errors are defined.
    
           _The following sections are informative._
    


## EXAMPLES



           Example _TZ_ variables and their timezone differences are given in
           the table below:
                              ┌────────────┬────────────┐
                              │     _TZ_     │  _timezone_  │
                              ├────────────┼────────────┤
                              │ EST5EDT    │ 5*60*60    │
                              │ GMT0       │ 0*60*60    │
                              │ JST-9      │ -9*60*60   │
                              │ MET-1MEST  │ -1*60*60   │
                              │ MST7MDT    │ 7*60*60    │
                              │ PST8PDT    │ 8*60*60    │
                              └────────────┴────────────┘
    


## APPLICATION USAGE



           Since the _ctime_(), _localtime_(), _mktime_(), _strftime_(), and
           _strftime_l_() functions are required to set timezone information as
           if by calling _tzset_(), there is no need for an explicit _tzset_()
           call before using these functions. However, portable applications
           should call _tzset_() explicitly before using _ctime_r_() or
           _localtime_r_() because setting timezone information is optional for
           those functions.
    


## RATIONALE



           None.
    


## FUTURE DIRECTIONS



           None.
    


* * *