TZSET(3)                   POSIX Programmer's Manual                  TZSET(3)



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

NNAAMMEE
       daylight, timezone, tzname, tzset -- set timezone conversion
       information

SSYYNNOOPPSSIISS
       #include <time.h>

       extern int daylight;
       extern long timezone;
       extern char *tzname[2];
       void tzset(void);

DDEESSCCRRIIPPTTIIOONN
       The _t_z_s_e_t() function shall use the value of the environment variable _T_Z
       to set time conversion information used by _c_t_i_m_e(), _l_o_c_a_l_t_i_m_e(),
       _m_k_t_i_m_e(), and _s_t_r_f_t_i_m_e().  If _T_Z is absent from the environment,
       implementation-defined default timezone information shall be used.

       The _t_z_s_e_t() function shall set the external variable _t_z_n_a_m_e as follows:


           tzname[0] = "_s_t_d";
           tzname[1] = "_d_s_t";

       where _s_t_d and _d_s_t are as described in the Base Definitions volume of
       POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t _V_a_r_i_a_b_l_e_s.

       The _t_z_s_e_t() function also shall set the external variable _d_a_y_l_i_g_h_t to 0
       if Daylight Savings Time conversions should never be applied for the
       timezone in use; otherwise, non-zero. The external variable _t_i_m_e_z_o_n_e
       shall be set to the difference, in seconds, between Coordinated
       Universal Time (UTC) and local standard time.

       If a thread accesses _t_z_n_a_m_e, _d_a_y_l_i_g_h_t, or _t_i_m_e_z_o_n_e directly while
       another thread is in a call to _t_z_s_e_t(), or to any function that is
       required or allowed to set timezone information as if by calling
       _t_z_s_e_t(), the behavior is undefined.

RREETTUURRNN VVAALLUUEE
       The _t_z_s_e_t() function shall not return a value.

EERRRROORRSS
       No errors are defined.

       _T_h_e _f_o_l_l_o_w_i_n_g _s_e_c_t_i_o_n_s _a_r_e _i_n_f_o_r_m_a_t_i_v_e_.

EEXXAAMMPPLLEESS
       Example _T_Z variables and their timezone differences are given in the
       table below:

                              +-----------+------------+
                              |    _T_Z     |  _t_i_m_e_z_o_n_e  |
                              +-----------+------------+
                              |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    |
                              +-----------+------------+
AAPPPPLLIICCAATTIIOONN UUSSAAGGEE
       Since the _c_t_i_m_e(), _l_o_c_a_l_t_i_m_e(), _m_k_t_i_m_e(), _s_t_r_f_t_i_m_e(), and _s_t_r_f_t_i_m_e___l()
       functions are required to set timezone information as if by calling
       _t_z_s_e_t(), there is no need for an explicit _t_z_s_e_t() call before using
       these functions. However, portable applications should call _t_z_s_e_t()
       explicitly before using _c_t_i_m_e___r() or _l_o_c_a_l_t_i_m_e___r() because setting
       timezone information is optional for those functions.

RRAATTIIOONNAALLEE
       None.

FFUUTTUURREE DDIIRREECCTTIIOONNSS
       None.

SSEEEE AALLSSOO
       _c_t_i_m_e(), _l_o_c_a_l_t_i_m_e(), _m_k_t_i_m_e(), _s_t_r_f_t_i_m_e()

       The Base Definitions volume of POSIX.1-2017, _C_h_a_p_t_e_r _8, _E_n_v_i_r_o_n_m_e_n_t
       _V_a_r_i_a_b_l_e_s, <<ttiimmee..hh>>

CCOOPPYYRRIIGGHHTT
       Portions of this text are reprinted and reproduced in electronic form
       from IEEE Std 1003.1-2017, Standard for Information Technology --
       Portable Operating System Interface (POSIX), The Open Group Base
       Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the
       Institute of Electrical and Electronics Engineers, Inc and The Open
       Group.  In the event of any discrepancy between this version and the
       original IEEE and The Open Group Standard, the original IEEE and The
       Open Group Standard is the referee document. The original Standard can
       be obtained online at http://www.opengroup.org/unix/online.html .

       Any typographical or formatting errors that appear in this page are
       most likely to have been introduced during the conversion of the source
       files to man page format. To report such errors, see
       https://www.kernel.org/doc/man-pages/reporting_bugs.html .



IEEE/The Open Group                  2017                             TZSET(3)
