]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - usr.sbin/zic/zic.8
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.git] / usr.sbin / zic / zic.8
1 .\" $FreeBSD$
2 .Dd June 20, 2004
3 .Dt ZIC 8
4 .Os
5 .Sh NAME
6 .Nm zic
7 .Nd timezone compiler
8 .Sh SYNOPSIS
9 .Nm
10 .Op Fl -version
11 .Op Fl Dsv
12 .Op Fl d Ar directory
13 .Op Fl g Ar group
14 .Op Fl L Ar leapsecondfilename
15 .Op Fl l Ar localtime
16 .Op Fl m Ar mode
17 .Op Fl p Ar posixrules
18 .Op Fl u Ar user
19 .Op Fl y Ar command
20 .Op Ar filename ...
21 .Sh DESCRIPTION
22 The
23 .Nm
24 utility reads text from the file(s) named on the command line
25 and creates the time conversion information files specified in this input.
26 If a
27 .Ar filename
28 is
29 .Em - ,
30 the standard input is read.
31 .Pp
32 The following options are available:
33 .Bl -tag -width indent
34 .It Fl -version
35 Output version information and exit.
36 .It Fl D
37 Do not automatically create directories.
38 If the input file(s) specify
39 an output file in a directory which does not already exist, the
40 default behavior is to attempt to create the directory.
41 If
42 .Fl D
43 is specified,
44 .Nm
45 will instead error out immediately.
46 .It Fl d Ar directory
47 Create time conversion information files in the named directory rather than
48 in the standard directory named below.
49 .It Fl g Ar group
50 After creating each output file, change its group ownership to the
51 specified
52 .Ar group
53 (which can be either a name or a numeric group ID).
54 .It Fl L Ar leapsecondfilename
55 Read leap second information from the file with the given name.
56 If this option is not used,
57 no leap second information appears in output files.
58 .It Fl l Ar timezone
59 Use the given
60 .Ar time zone
61 as local time.
62 The
63 .Nm
64 utility will act as if the input contained a link line of the form
65 .Pp
66 .D1 No "Link    timezone                localtime"
67 .Pp
68 (Note that this action has no effect on
69 .Fx ,
70 since the local time zone is specified in
71 .Pa /etc/localtime
72 and not
73 .Pa /usr/share/zoneinfo/localtime . )
74 .It Fl m Ar mode
75 After creating each output file, change its access mode to
76 .Ar mode .
77 Both numeric and alphabetic modes are accepted
78 (see
79 .Xr chmod 1 ) .
80 .It Fl p Ar timezone
81 Use the given
82 .Ar "time zone" Ns 's
83 rules when handling POSIX-format
84 time zone environment variables.
85 The
86 .Nm
87 utility will act as if the input contained a link line of the form
88 .Pp
89 .D1 No "Link    timezone                posixrules"
90 .It Fl u Ar user
91 After creating each output file, change its owner to
92 .Ar user
93 (which can be either a name or a numeric user ID).
94 .It Fl v
95 Complain if a year that appears in a data file is outside the range
96 of years representable by
97 .Xr time 3
98 values.
99 .It Fl s
100 Limit time values stored in output files to values that are the same
101 whether they are taken to be signed or unsigned.
102 You can use this option to generate SVVS-compatible files.
103 .It Fl y Ar command
104 Use the given
105 .Ar command
106 rather than
107 .Em yearistype
108 when checking year types (see below).
109 .El
110 .Pp
111 Input lines are made up of fields.
112 Fields are separated from one another by any number of white space characters.
113 Leading and trailing white space on input lines is ignored.
114 An unquoted sharp character (#) in the input introduces a comment which extends
115 to the end of the line the sharp character appears on.
116 White space characters and sharp characters may be enclosed in double quotes
117 (") if they are to be used as part of a field.
118 Any line that is blank (after comment stripping) is ignored.
119 Non-blank lines are expected to be of one of three types:
120 rule lines, zone lines, and link lines.
121 .Pp
122 A rule line has the form:
123 .Dl "Rule       NAME    FROM    TO      TYPE    IN      ON              AT      SAVE    LETTER/S
124 For example:
125 .Dl "Rule       US      1967    1973    \-      Apr     lastSun 2:00    1:00    D
126 .Pp
127 The fields that make up a rule line are:
128 .Bl -tag -width "LETTER/S" -offset indent
129 .It NAME
130 Give the (arbitrary) name of the set of rules this rule is part of.
131 .It FROM
132 Give the first year in which the rule applies.
133 Any integer year can be supplied; the Gregorian calendar is assumed.
134 The word
135 .Em minimum
136 (or an abbreviation) means the minimum year representable as an integer.
137 The word
138 .Em maximum
139 (or an abbreviation) means the maximum year representable as an integer.
140 Rules can describe times that are not representable as time values,
141 with the unrepresentable times ignored; this allows rules to be portable
142 among hosts with differing time value types.
143 .It TO
144 Give the final year in which the rule applies.
145 In addition to
146 .Em minimum
147 and
148 .Em maximum
149 (as above),
150 the word
151 .Em only
152 (or an abbreviation)
153 may be used to repeat the value of the
154 .Em FROM
155 field.
156 .It TYPE
157 Give the type of year in which the rule applies.
158 If
159 .Em TYPE
160 is
161 .Em \-
162 then the rule applies in all years between
163 .Em FROM
164 and
165 .Em TO
166 inclusive.
167 If
168 .Em TYPE
169 is something else, then
170 .Nm
171 executes the command
172 .Li yearistype Ar year Ar type
173 to check the type of a year:
174 an exit status of zero is taken to mean that the year is of the given type;
175 an exit status of one is taken to mean that the year is not of the given type.
176 .It IN
177 Name the month in which the rule takes effect.
178 Month names may be abbreviated.
179 .It ON
180 Give the day on which the rule takes effect.
181 Recognized forms include:
182 .Pp
183 .Bl -tag -width lastSun -compact -offset indent
184 .It \&5
185 the fifth of the month
186 .It lastSun
187 the last Sunday in the month
188 .It lastMon
189 the last Monday in the month
190 .It Sun>=8
191 first Sunday on or after the eighth
192 .It Sun<=25
193 last Sunday on or before the 25th
194 .El
195 .Pp
196 Names of days of the week may be abbreviated or spelled out in full.
197 Note that there must be no spaces within the
198 .Em ON
199 field.
200 .It AT
201 Give the time of day at which the rule takes effect.
202 Recognized forms include:
203 .Pp
204 .Bl -tag -width "\&1:28:14" -offset indent -compact
205 .It 2
206 time in hours
207 .It 2:00
208 time in hours and minutes
209 .It 15:00
210 24-hour format time (for times after noon)
211 .It 1:28:14
212 time in hours, minutes, and seconds
213 .El
214 .Pp
215 where hour 0 is midnight at the start of the day,
216 and hour 24 is midnight at the end of the day.
217 Any of these forms may be followed by the letter
218 .Sq Li w
219 if the given time is local
220 .Dq "wall clock"
221 time,
222 .Sq Li s
223 if the given time is local
224 .Dq standard
225 time, or
226 .Sq Li u
227 (or
228 .Sq Li g
229 or
230 .Sq Li z )
231 if the given time is universal time;
232 in the absence of an indicator,
233 wall clock time is assumed.
234 .It SAVE
235 Give the amount of time to be added to local standard time when the rule is in
236 effect.
237 This field has the same format as the
238 .Em AT
239 field
240 (although, of course, the
241 .Sq Li w
242 and
243 .Sq Li s
244 suffixes are not used).
245 .It LETTER/S
246 Give the
247 .Dq "variable part"
248 (for example, the
249 .Dq S
250 or
251 .Dq D
252 in
253 .Dq EST
254 or
255 .Dq EDT )
256 of time zone abbreviations to be used when this rule is in effect.
257 If this field is
258 .Em \- ,
259 the variable part is null.
260 .El
261 .Pp
262 A zone line has the form:
263 .Dl "Zone       NAME    GMTOFF  RULES/SAVE      FORMAT  [UNTILYEAR [MONTH [DAY [TIME]]]]"
264 For example:
265 .Dl "Zone       Australia/Adelaide      9:30    Aus     CST     1971 Oct 31 2:00
266 The fields that make up a zone line are:
267 .Bl -tag -width indent
268 .It NAME
269 The name of the time zone.
270 This is the name used in creating the time conversion information file for the
271 zone.
272 .It GMTOFF
273 The amount of time to add to UTC to get standard time in this zone.
274 This field has the same format as the
275 .Em AT
276 and
277 .Em SAVE
278 fields of rule lines;
279 begin the field with a minus sign if time must be subtracted from UTC.
280 .It RULES/SAVE
281 The name of the rule(s) that apply in the time zone or,
282 alternately, an amount of time to add to local standard time.
283 If this field is
284 .Em \-
285 then standard time always applies in the time zone.
286 .It FORMAT
287 The format for time zone abbreviations in this time zone.
288 The pair of characters
289 .Em %s
290 is used to show where the
291 .Dq "variable part"
292 of the time zone abbreviation goes.
293 Alternately,
294 a slash (/)
295 separates standard and daylight abbreviations.
296 .It UNTILYEAR [MONTH [DAY [TIME]]]
297 The time at which the UTC offset or the rule(s) change for a location.
298 It is specified as a year, a month, a day, and a time of day.
299 If this is specified,
300 the time zone information is generated from the given UTC offset
301 and rule change until the time specified.
302 The month, day, and time of day have the same format as the IN, ON, and AT
303 fields of a rule; trailing fields can be omitted, and default to the
304 earliest possible value for the missing fields.
305 .Pp
306 The next line must be a
307 .Dq continuation
308 line; this has the same form as a zone line except that the
309 string
310 .Dq Zone
311 and the name are omitted, as the continuation line will
312 place information starting at the time specified as the
313 .Em until
314 information in the previous line in the file used by the previous line.
315 Continuation lines may contain
316 .Em until
317 information, just as zone lines do, indicating that the next line is a further
318 continuation.
319 .El
320 .Pp
321 A link line has the form
322 .Dl "Link       LINK-FROM       LINK-TO
323 For example:
324 .Dl "Link       Europe/Istanbul Asia/Istanbul
325 The
326 .Em LINK-FROM
327 field should appear as the
328 .Em NAME
329 field in some zone line;
330 the
331 .Em LINK-TO
332 field is used as an alternate name for that zone.
333 .Pp
334 Except for continuation lines,
335 lines may appear in any order in the input.
336 .Pp
337 Lines in the file that describes leap seconds have the following form:
338 .Dl "Leap       YEAR    MONTH   DAY     HH:MM:SS        CORR    R/S
339 For example:
340 .Dl "Leap       1974    Dec     31      23:59:60        +       S
341 The
342 .Em YEAR ,
343 .Em MONTH ,
344 .Em DAY ,
345 and
346 .Em HH:MM:SS
347 fields tell when the leap second happened.
348 The
349 .Em CORR
350 field
351 should be
352 .Dq +
353 if a second was added
354 or
355 .Dq -
356 if a second was skipped.
357 .\" There's no need to document the following, since it's impossible for more
358 .\" than one leap second to be inserted or deleted at a time.
359 .\" The C Standard is in error in suggesting the possibility.
360 .\" See Terry J Quinn, The BIPM and the accurate measure of time,
361 .\" Proc IEEE 79, 7 (July 1991), 894-905.
362 .\"     or
363 .\"     .q ++
364 .\"     if two seconds were added
365 .\"     or
366 .\"     .q --
367 .\"     if two seconds were skipped.
368 The
369 .Em R/S
370 field
371 should be (an abbreviation of)
372 .Dq Stationary
373 if the leap second time given by the other fields should be interpreted as UTC
374 or
375 (an abbreviation of)
376 .Dq Rolling
377 if the leap second time given by the other fields should be interpreted as
378 local wall clock time.
379 .Sh "EXTENDED EXAMPLE"
380 Here is an extended example of
381 .Nm
382 input, intended to illustrate many of its features.
383 .br
384 .ne 22
385 .nf
386 .in +2m
387 .ta \w'# Rule\0\0'u +\w'NAME\0\0'u +\w'FROM\0\0'u +\w'1973\0\0'u +\w'TYPE\0\0'u +\w'Apr\0\0'u +\w'lastSun\0\0'u +\w'2:00\0\0'u +\w'SAVE\0\0'u
388 .sp
389 # Rule  NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
390 Rule    Swiss   1940    only    -       Nov     2       0:00    1:00    S
391 Rule    Swiss   1940    only    -       Dec     31      0:00    0       -
392 Rule    Swiss   1941    1942    -       May     Sun>=1  2:00    1:00    S
393 Rule    Swiss   1941    1942    -       Oct     Sun>=1  0:00    0
394 .sp .5
395 Rule    EU      1977    1980    -       Apr     Sun>=1  1:00u   1:00    S
396 Rule    EU      1977    only    -       Sep     lastSun 1:00u   0       -
397 Rule    EU      1978    only    -       Oct      1      1:00u   0       -
398 Rule    EU      1979    1995    -       Sep     lastSun 1:00u   0       -
399 Rule    EU      1981    max     -       Mar     lastSun 1:00u   1:00    S
400 Rule    EU      1996    max     -       Oct     lastSun 1:00u   0       -
401 .sp
402 .ta \w'# Zone\0\0'u +\w'Europe/Zurich\0\0'u +\w'0:34:08\0\0'u +\w'RULES/SAVE\0\0'u +\w'FORMAT\0\0'u
403 # Zone  NAME    GMTOFF  RULES   FORMAT  UNTIL
404 Zone    Europe/Zurich   0:34:08 -       LMT     1848 Sep 12
405                 0:29:44 -       BMT     1894 Jun
406                 1:00    Swiss   CE%sT   1981
407                 1:00    EU      CE%sT
408 .sp
409 Link    Europe/Zurich   Switzerland
410 .sp
411 .in
412 .fi
413 In this example, the zone is named Europe/Zurich but it has an alias
414 as Switzerland.
415 Zurich was 34 minutes and 8 seconds west of GMT until 1848-09-12
416 at 00:00, when the offset changed to 29 minutes and 44 seconds.
417 After 1894-06-01 at 00:00 Swiss daylight saving rules (defined with
418 lines beginning with "Rule Swiss") apply, and the GMT offset became
419 one hour.
420 From 1981 to the present, EU daylight saving rules have applied,
421 and the UTC offset has remained at one hour.
422 .Pp
423 In 1940, daylight saving time applied from November 2 at 00:00 to
424 December 31 at 00:00.
425 In 1941 and 1942, daylight saving time applied from the first Sunday
426 in May at 02:00 to the first Sunday in October at 00:00.
427 The pre-1981 EU daylight-saving rules have no effect here, but are
428 included for completeness.
429 Since 1981, daylight saving has begun on the last Sunday in March
430 at 01:00 UTC.
431 Until 1995 it ended the last Sunday in September at 01:00 UTC, but
432 this changed to the last Sunday in October starting in 1996.
433 .Pp
434 For purposes of display, "LMT" and "BMT" were initially used,
435 respectively.
436 Since Swiss rules and later EU rules were applied, the display name
437 for the timezone has been CET for standard time and CEST for daylight
438 saving time.
439 .Sh NOTES
440 For areas with more than two types of local time,
441 you may need to use local standard time in the
442 .Em AT
443 field of the earliest transition time's rule to ensure that
444 the earliest transition time recorded in the compiled file is correct.
445 .Pp
446 If, for a particular zone, a clock advance caused by the start of
447 daylight saving coincides with and is equal to a clock retreat
448 caused by a change in UTC offset,
449 .Nm
450 produces a single transition to daylight saving at the new UTC offset
451 (without any change in wall clock time).
452 To get separate transitions use multiple zone continuation lines
453 specifying transition instants using universal time.
454 .Sh FILES
455 .Bl -tag -width /usr/share/zoneinfo -compact
456 .It /usr/share/zoneinfo
457 standard directory used for created files
458 .El
459 .Sh "SEE ALSO"
460 .Xr ctime 3 ,
461 .Xr tzfile 5 ,
462 .Xr zdump 8
463 .\" @(#)zic.8   8.5
464 .\" This file is in the public domain, so clarified as of
465 .\" 2009-05-17 by Arthur David Olson.