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