1TZSET(3P) POSIX Programmer's Manual TZSET(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 daylight, timezone, tzname, tzset — set timezone conversion information
13
15 #include <time.h>
16
17 extern int daylight;
18 extern long timezone;
19 extern char *tzname[2];
20 void tzset(void);
21
23 The tzset() function shall use the value of the environment variable TZ
24 to set time conversion information used by ctime(), localtime(),
25 mktime(), and strftime(). If TZ is absent from the environment, imple‐
26 mentation-defined default timezone information shall be used.
27
28 The tzset() function shall set the external variable tzname as follows:
29
30
31 tzname[0] = "std";
32 tzname[1] = "dst";
33
34 where std and dst are as described in the Base Definitions volume of
35 POSIX.1‐2017, Chapter 8, Environment Variables.
36
37 The tzset() function also shall set the external variable daylight to 0
38 if Daylight Savings Time conversions should never be applied for the
39 timezone in use; otherwise, non-zero. The external variable timezone
40 shall be set to the difference, in seconds, between Coordinated Univer‐
41 sal Time (UTC) and local standard time.
42
43 If a thread accesses tzname, daylight, or timezone directly while
44 another thread is in a call to tzset(), or to any function that is
45 required or allowed to set timezone information as if by calling
46 tzset(), the behavior is undefined.
47
49 The tzset() function shall not return a value.
50
52 No errors are defined.
53
54 The following sections are informative.
55
57 Example TZ variables and their timezone differences are given in the
58 table below:
59
60 ┌───────────┬────────────┐
61 │ TZ │ timezone │
62 ├───────────┼────────────┤
63 │EST5EDT │ 5*60*60 │
64 │GMT0 │ 0*60*60 │
65 │JST-9 │ -9*60*60 │
66 │MET-1MEST │ -1*60*60 │
67 │MST7MDT │ 7*60*60 │
68 │PST8PDT │ 8*60*60 │
69 └───────────┴────────────┘
71 Since the ctime(), localtime(), mktime(), strftime(), and strftime_l()
72 functions are required to set timezone information as if by calling
73 tzset(), there is no need for an explicit tzset() call before using
74 these functions. However, portable applications should call tzset()
75 explicitly before using ctime_r() or localtime_r() because setting
76 timezone information is optional for those functions.
77
79 None.
80
82 None.
83
85 ctime(), localtime(), mktime(), strftime()
86
87 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
88 Variables, <time.h>
89
91 Portions of this text are reprinted and reproduced in electronic form
92 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
93 table Operating System Interface (POSIX), The Open Group Base Specifi‐
94 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
95 Electrical and Electronics Engineers, Inc and The Open Group. In the
96 event of any discrepancy between this version and the original IEEE and
97 The Open Group Standard, the original IEEE and The Open Group Standard
98 is the referee document. The original Standard can be obtained online
99 at http://www.opengroup.org/unix/online.html .
100
101 Any typographical or formatting errors that appear in this page are
102 most likely to have been introduced during the conversion of the source
103 files to man page format. To report such errors, see https://www.ker‐
104 nel.org/doc/man-pages/reporting_bugs.html .
105
106
107
108IEEE/The Open Group 2017 TZSET(3P)