Commit | Line | Data |
---|---|---|
b383a98b KB |
1 | .\" Copyright (c) 1989 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" This code is derived from software contributed to Berkeley by | |
5 | .\" Arthur Olson. | |
6 | .\" | |
7 | .\" %sccs.include.redist.man% | |
8 | .\" | |
9 | .\" @(#)tzset.3 5.1 (Berkeley) %G% | |
10 | .\" | |
11 | .TH TZSET 3 "" | |
12 | .SH NAME | |
13 | tzset, tzsetwall \- initialize time conversion information | |
14 | .SH SYNOPSIS | |
15 | .nf | |
16 | .ft B | |
17 | void tzset() | |
18 | ||
19 | void tzsetwall() | |
20 | .ft R | |
21 | .fi | |
22 | .SH DESCRIPTION | |
23 | .I Tzset | |
24 | initializes time conversion information used by the library routine | |
25 | .IR localtime . | |
26 | The environment variable | |
27 | .B TZ | |
28 | specifies how this is done. | |
29 | .PP | |
30 | If | |
31 | .B TZ | |
32 | does not appear in the environment, the best available approximation to | |
33 | local wall clock time, as specified by the | |
34 | .IR tzfile (5)-format | |
35 | file ``/etc/localtime'' is used. | |
36 | .PP | |
37 | If | |
38 | .B TZ | |
39 | appears in the environment but its value is a null string, Coordinated | |
40 | Universal Time (UTC) is used (without leap second correction). | |
41 | .PP | |
42 | If | |
43 | .B TZ | |
44 | appears in the environment and its value begins with a colon (``:''), | |
45 | the rest of its value is used as a pathname of a | |
46 | .IR tzfile (5)-format | |
47 | file from which to read the time conversion information. | |
48 | If the first character of the pathname is a slash (``/'') it is used as | |
49 | an absolute pathname; otherwise, it is used as a pathname relative to | |
50 | the system time conversion information directory. | |
51 | .PP | |
52 | If its value does not begin with a colon, it is first used as the pathname | |
53 | of a file (as described above) from which to read the time conversion | |
54 | information. | |
55 | If that file cannot be read, the value is then interpreted as a direct | |
56 | specification (the format is described below) of the time conversion | |
57 | information. | |
58 | .PP | |
59 | If the | |
60 | .B TZ | |
61 | environment variable does not specify a | |
62 | .IR tzfile (5)-format | |
63 | file and cannot be interpreted as a direct specification, | |
64 | UTC is used. | |
65 | .PP | |
66 | .I Tzsetwall | |
67 | sets things up so that | |
68 | .I localtime | |
69 | returns the best available approximation of local wall clock time. | |
70 | .SH "SPECIFICATION FORMAT" | |
71 | When | |
72 | .B TZ | |
73 | is used directly as a specification of the time conversion information, | |
74 | it must have the following syntax (spaces inserted for clarity): | |
75 | .IP | |
76 | \fIstd\|offset\fR[\fIdst\fR[\fIoffset\fR][\fB,\fIrule\fR]] | |
77 | .PP | |
78 | Where: | |
79 | .RS | |
80 | .TP 15 | |
81 | .IR std " and " dst | |
82 | Three or more bytes that are the designation for the standard | |
83 | .RI ( std ) | |
84 | or summer | |
85 | .RI ( dst ) | |
86 | time zone. Only | |
87 | .I std | |
88 | is required; if | |
89 | .I dst | |
90 | is missing, then summer time does not apply in this locale. | |
91 | Upper- and lowercase letters are explicitly allowed. Any characters | |
92 | except a leading colon | |
93 | .RB ( : ), | |
94 | digits, comma | |
95 | .RB ( , ), | |
96 | minus | |
97 | .RB ( \(mi ), | |
98 | plus | |
99 | .RB ( \(pl ), | |
100 | and ASCII NUL are allowed. | |
101 | .TP | |
102 | .I offset | |
103 | Indicates the value one must add to the local time to arrive at | |
104 | Coordinated Universal Time. The | |
105 | .I offset | |
106 | has the form: | |
107 | .RS | |
108 | .IP | |
109 | \fIhh\fR[\fB:\fImm\fR[\fB:\fIss\fR]] | |
110 | .RE | |
111 | .IP | |
112 | The minutes | |
113 | .RI ( mm ) | |
114 | and seconds | |
115 | .RI ( ss ) | |
116 | are optional. The hour | |
117 | .RI ( hh ) | |
118 | is required and may be a single digit. The | |
119 | .I offset | |
120 | following | |
121 | .I std | |
122 | is required. If no | |
123 | .I offset | |
124 | follows | |
125 | .IR dst , | |
126 | summer time is assumed to be one hour ahead of standard time. One or | |
127 | more digits may be used; the value is always interpreted as a decimal | |
128 | number. The hour must be between zero and 24, and the minutes (and | |
129 | seconds) \(em if present \(em between zero and 59. If preceded by a | |
130 | .RB `` \(mi '', | |
131 | the time zone shall be east of the Prime Meridian; otherwise it shall be | |
132 | west (which may be indicated by an optional preceding | |
133 | .RB `` \(pl ''). | |
134 | .TP | |
135 | .I rule | |
136 | Indicates when to change to and back from summer time. The | |
137 | .I rule | |
138 | has the form: | |
139 | .RS | |
140 | .IP | |
141 | \fIdate\fB/\fItime\fB,\fIdate\fB/\fItime\fR | |
142 | .RE | |
143 | .IP | |
144 | where the first | |
145 | .I date | |
146 | describes when the change from standard to summer time occurs and the | |
147 | second | |
148 | .I date | |
149 | describes when the change back happens. Each | |
150 | .I time | |
151 | field describes when, in current local time, the change to the other | |
152 | time is made. | |
153 | .IP | |
154 | The format of | |
155 | .I date | |
156 | is one of the following: | |
157 | .RS | |
158 | .TP 10 | |
159 | .BI J n | |
160 | The Julian day | |
161 | .I n | |
162 | .RI "(1\ \(<=" "\ n\ " "\(<=\ 365). | |
163 | Leap days are not counted; that is, in all years \(em including leap | |
164 | years \(em February 28 is day 59 and March 1 is day 60. It is | |
165 | impossible to explicitly refer to the occasional February 29. | |
166 | .TP | |
167 | .I n | |
168 | The zero-based Julian day | |
169 | .RI "(0\ \(<=" "\ n\ " "\(<=\ 365). | |
170 | Leap days are counted, and it is possible to refer to February 29. | |
171 | .TP | |
172 | .BI M m . n . d | |
173 | The | |
174 | .IR d' th | |
175 | day | |
176 | .RI "(0\ \(<=" "\ d\ " "\(<=\ 6) | |
177 | of week | |
178 | .I n | |
179 | of month | |
180 | .I m | |
181 | of the year | |
182 | .RI "(1\ \(<=" "\ n\ " "\(<=\ 5, | |
183 | .RI "1\ \(<=" "\ m\ " "\(<=\ 12, | |
184 | where week 5 means ``the last | |
185 | .I d | |
186 | day in month | |
187 | .IR m '' | |
188 | which may occur in either the fourth or the fifth week). Week 1 is the | |
189 | first week in which the | |
190 | .IR d' th | |
191 | day occurs. Day zero is Sunday. | |
192 | .RE | |
193 | .IP "" 15 | |
194 | The | |
195 | .I time | |
196 | has the same format as | |
197 | .I offset | |
198 | except that no leading sign | |
199 | .RB (`` \(mi '' | |
200 | or | |
201 | .RB `` \(pl '') | |
202 | is allowed. The default, if | |
203 | .I time | |
204 | is not given, is | |
205 | .BR 02:00:00 . | |
206 | .RE | |
207 | .LP | |
208 | If no | |
209 | .I rule | |
210 | is present in the | |
211 | .BR TZ | |
212 | specification, the rules specified | |
213 | by the | |
214 | .IR tzfile (5)-format | |
215 | file | |
216 | .B posixrules | |
217 | in the system time conversion information directory are used, with the | |
218 | standard and summer time offsets from UTC replaced by those specified by | |
219 | the | |
220 | .I offset | |
221 | values in | |
222 | .BR TZ . | |
223 | .PP | |
224 | For compatibility with System V Release 3.1, a semicolon | |
225 | .RB ( ; ) | |
226 | may be used to separate the | |
227 | .I rule | |
228 | from the rest of the specification. | |
229 | .SH FILES | |
230 | .ta \w'/usr/share/zoneinfo/posixrules\0\0'u | |
231 | /etc/localtime local time zone file | |
232 | .br | |
233 | /usr/share/zoneinfo time zone directory | |
234 | .br | |
235 | /usr/share/zoneinfo/posixrules rules for POSIX-style TZ's | |
236 | .br | |
237 | /usr/share/zoneinfo/GMT for UTC leap seconds | |
238 | .sp | |
239 | If | |
240 | .I /usr/share/zoneinfo/GMT | |
241 | is absent, UTC leap seconds are loaded from | |
242 | .IR /usr/share/zoneinfo/posixrules . | |
243 | .SH SEE ALSO | |
244 | date(1), gettimeofday(2), ctime(3), getenv(3), time(3), tzfile(5) |