xref: /minix3/lib/libc/time/zic.8 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1.\"	$NetBSD: zic.8,v 1.26 2015/08/13 11:21:18 christos Exp $
2.Dd August 13, 2015
3.Dt ZIC 8
4.Os
5.Sh NAME
6.Nm zic
7.Nd time zone compiler
8.Sh SYNOPSIS
9.Nm
10.Op Fl \-version
11.Op Fl d Ar directory
12.Op Fl L Ar leapsecondfilename
13.Op Fl l Ar localtime
14.Op Fl p Ar posixrules
15.Op Fl s
16.Op Fl v
17.Op Fl y Ar command
18.Op Ar Filename ...
19.Sh DESCRIPTION
20.Nm
21reads text from the file(s) named on the command line
22and creates the time conversion information files specified in this input.
23If a
24.Ar filename
25is
26.Ar \&- ,
27the standard input is read.
28.Pp
29These options are available:
30.Bl -tag -width XXXXXXXXXX -compact
31.It Fl \-version
32Output version information and exit.
33.It Fl d Ar directory
34Create time conversion information files in the named directory rather than
35in the standard directory named below.
36.It Fl L Ar leapsecondfilename
37Read leap second information from the file with the given name.
38If this option is not used,
39no leap second information appears in output files.
40.It Fl l Ar timezone
41Use the given time zone as local time.
42.Nm
43will act as if the input contained a link line of the form
44.Dl Link	timezone	localtime
45.It Fl p Ar timezone
46Use the given time zone's rules when handling POSIX-format
47time zone environment variables.
48.Nm
49will act as if the input contained a link line of the form
50.Dl Link	timezone	posixrules
51.It Fl s
52Limit time values stored in output files to values that are the same
53whether they're taken to be signed or unsigned.
54You can use this option to generate SVVS-compatible files.
55.It Fl v
56Be more verbose, and complain about the following situations:
57.Bl -dash
58.It The input specifies a link to a link.
59.It A year that appears in a data file is outside the range
60.It A time of 24:00 or more appears in the input.
61Pre-1998 versions of
62.Xr zic 8
63prohibit 24:00, and pre-2007 versions prohibit times greater than 24:00.
64.It A rule goes past the start or end of the month.
65Pre-2004 versions of
66.Xr zic 8
67prohibit this.
68.It The output file does not contain all the information about the
69long-term future of a zone, because the future cannot be summarized as
70an extended POSIX TZ string.
71For example, as of 2013 this problem
72occurs for Iran's daylight-saving rules for the predicted future, as
73these rules are based on the Iranian calendar, which cannot be
74represented.
75.It The output contains data that may not be handled properly by client
76code designed for older
77.Xr zic 8
78output formats.
79These compatibility issues affect only time stamps
80before 1970 or after the start of 2038.
81.It A time zone abbreviation has fewer than 3 characters.
82POSIX requires at least 3.
83.It An output file name contains a byte that is not an ASCII letter,
84.Dq - ,
85.Dq / ,
86or
87.Dq _ ;
88or it
89or it contains a file name component that contains more than 14 bytes
90or that starts with
91.Dq - .
92.El
93.Pp
94Input files should be text files, that is, they should be a series of
95zero or more lines, each ending in a newline byte and containing at
96most 511 bytes, and without any
97.Dv NUL
98bytes.
99The input text's encoding
100is typically UTF-8 or ASCII; it should have a unibyte representation
101for the POSIX Portable Character Set (PPCS)
102.%U http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap06.html
103and the encoding's non-unibyte characters should consist entirely of
104non-PPCS bytes.
105Non-PPCS characters typically occur only in comments:
106although output file names and time zone abbreviations can contain
107nearly any character, other software will work better if these are
108limited to the restricted syntax described under the
109.Op v
110option.
111.Pp
112Input lines are made up of fields.
113Fields are separated from one another by one or more white space characters.
114The white space characters are space, form feed, carriage return, newline,
115tab, and vertical tab.
116Leading and trailing white space on input lines is ignored.
117An unquoted sharp character (#) in the input introduces a comment which extends
118to the end of the line the sharp character appears on.
119White space characters and sharp characters may be enclosed in double
120quotes
121.Pq \&"
122.\" XXX "
123if they're to be used as part of a field.
124Any line that is blank (after comment stripping) is ignored.
125Non-blank lines are expected to be of one of three types:
126rule lines, zone lines, and link lines.
127.Pp
128Names (such as month names) must be in English and are case insensitive.
129Abbreviations, if used, must be unambiguous in context.
130.Pp
131A rule line has the form
132.Dl Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
133For example:
134.Dl Rule	US	1967	1973	\-	Apr	lastSun	2:00	1:00	D
135The fields that make up a rule line are:
136.Bl -tag -width "LETTER/S" -compact
137.It NAME
138Gives the (arbitrary) name of the set of rules this rule is part of.
139.It FROM
140Gives the first year in which the rule applies.
141Any integer year can be supplied; the proleptic Gregorian calendar is assumed.
142The word
143.Em minimum
144(or an abbreviation) means the minimum year representable as an integer.
145The word
146.Em maximum
147(or an abbreviation) means the maximum year representable as an integer.
148Rules can describe times that are not representable as time values,
149with the unrepresentable times ignored; this allows rules to be portable
150among hosts with differing time value types.
151.It TO
152Gives the final year in which the rule applies.
153In addition to
154.Em minimum
155and
156.Em maximum
157(as above),
158the word
159.Em only
160(or an abbreviation)
161may be used to repeat the value of the
162.Em FROM
163field.
164.It TYPE
165should be
166.Dq -
167and is present for compatibility with older versions of
168.Nm
169in which it could contain year types.
170.It IN
171Names the month in which the rule takes effect.
172Month names may be abbreviated.
173.It ON
174Gives the day on which the rule takes effect.
175Recognized forms include:
176.Bl -tag -width lastSun -compact -offset indent
177.It 5
178the fifth of the month
179.It lastSun
180the last Sunday in the month
181.It lastMon
182the last Monday in the month
183.It Sun\*[Ge]8
184first Sunday on or after the eighth
185.It Sun\*[Le]25
186last Sunday on or before the 25th
187.El
188Names of days of the week may be abbreviated or spelled out in full.
189Note that there must be no spaces within the
190.Em ON
191field.
192.It AT
193Gives the time of day at which the rule takes effect.
194Recognized forms include:
195.Bl -tag -width "1X28X14" -compact -offset indent
196.It 2
197time in hours
198.It 2:00
199time in hours and minutes
200.It 15:00
20124-hour format time (for times after noon)
202.It 1:28:14
203time in hours, minutes, and seconds
204.It \-
205equivalent to 0
206.El
207where hour 0 is midnight at the start of the day,
208and hour 24 is midnight at the end of the day.
209Any of these forms may be followed by the letter
210.Em w
211if the given time is local
212.Dq wall clock
213time,
214.Em s
215if the given time is local
216.Dq standard
217time, or
218.Em u
219(or
220.Em g
221or
222.Em z )
223if the given time is universal time;
224in the absence of an indicator,
225wall clock time is assumed.
226The intent is that a rule line describes the instants when a
227clock/calendar set to the type of time specified in the
228.Em AT
229field would show the specified date and time of day.
230.It SAVE
231Gives the amount of time to be added to local standard time when the rule is in
232effect.
233This field has the same format as the
234.Em AT
235field
236(although, of course, the
237.Em w
238and
239.Em s
240suffixes are not used).
241Only the sum of standard time and this amount matters; for example,
242.Nm
243does not distinguish a 10:30 standard time plus an 0:30
244.Em SAVE
245from a 10:00 standard time plus a 1:00
246.Em SAVE .
247.It LETTER/S
248Gives the
249.Dq variable part
250(for example, the
251.Dq S
252or
253.Dq D
254in
255.Dq EST
256or
257.Dq EDT )
258of time zone abbreviations to be used when this rule is in effect.
259If this field is
260.Em \&- ,
261the variable part is null.
262.El
263.Pp
264A zone line has the form
265.sp
266.Dl Zone	NAME			GMTOFF	RULES/SAVE	FORMAT	[UNTILYEAR [MONTH [DAY [TIME]]]]
267For example:
268.Dl Zone	Australia/Adelaide	9:30	Aus	AC%sT	1971 Oct 31 2:00
269The fields that make up a zone line are:
270.Bl -tag -width "RULES/SAVE" -compact
271.It NAME
272The name of the time zone.
273This is the name used in creating the time conversion information file for the
274zone.
275It should not contain a file name component
276.Dq .
277or
278.Dq .. ;
279a file name component is a maximal substring that does not contain
280.Dq / .
281.It GMTOFF
282The amount of time to add to UT to get standard time in this zone.
283This field has the same format as the
284.Em AT
285and
286.Em SAVE
287fields of rule lines;
288begin the field with a minus sign if time must be subtracted from UT.
289.It RULES/SAVE
290The name of the rule(s) that apply in the time zone or,
291alternatively, an amount of time to add to local standard time.
292If this field is
293.Em \&-
294then standard time always applies in the time zone.
295When an amount of time is given, only the sum of standard time and
296this amount matters.
297.It FORMAT
298The format for time zone abbreviations in this time zone.
299The pair of characters
300.Em %s
301is used to show where the
302.Dq variable part
303of the time zone abbreviation goes.
304Alternately, a format can use the pair of characters
305.Em %z
306+to stand for the UTC offset in the form
307.Em \(+- hh ,
308.Em \(+- hhmm ,
309or
310.Em \(+- hhmmss ,
311using the shortest form that does not lose information, where
312.Em hh ,
313.Em mm ,
314and
315.Em ss
316are the hours, minutes, and seconds east (+) or west (\(mi) of UTC.
317Alternatively,
318a slash
319.Pq \&/
320separates standard and daylight abbreviations.
321To conform to POSIX, a time zone abbreviation should contain only
322alphanumeric ASCII characters, "+" and "\*-".
323.It UNTILYEAR [MONTH [DAY [TIME]]]
324The time at which the UT offset or the rule(s) change for a location.
325It is specified as a year, a month, a day, and a time of day.
326If this is specified,
327the time zone information is generated from the given UT offset
328and rule change until the time specified, which is interpreted using
329the rules in effect just before the transition.
330The month, day, and time of day have the same format as the IN, ON, and AT
331fields of a rule; trailing fields can be omitted, and default to the
332earliest possible value for the missing fields.
333.El
334The next line must be a
335.Dq continuation
336line; this has the same form as a zone line except that the
337string
338.Dq Zone
339and the name are omitted, as the continuation line will
340place information starting at the time specified as the
341.Em until
342information in the previous line in the file used by the previous line.
343Continuation lines may contain
344.Em until
345information, just as zone lines do, indicating that the next line is a further
346continuation.
347.Pp
348If a zone changes at the same instant that a rule would otherwise take
349effect in the earlier zone or continuation line, the rule is ignored.
350In a single zone it is an error if two rules take effect at the same
351instant, or if two zone changes take effect at the same instant.
352.Pp
353A link line has the form
354.Dl Link	TARGET	LINK-NAME
355For example:
356.Dl Link	Europe/Istanbul	Asia/Istanbul
357The
358.Em TARGET
359field should appear as the
360.Em NAME
361field in some zone line.
362The
363.Em LINK-NAME
364field is used as an alternative name for that zone;
365it has the same syntax as a zone line's
366.Em NAME
367field.
368.Pp
369Except for continuation lines,
370lines may appear in any order in the input.
371However, the behavior is unspecified if multiple zone or link lines
372define the same name, or if the source of one link line is the target
373of another.
374.Pp
375Lines in the file that describes leap seconds have the following form:
376.Dl Leap	YEAR	MONTH	DAY	HH:MM:SS	CORR	R/S
377For example:
378.Dl Leap	1974	Dec	31	23:59:60	+	S
379The
380.Em YEAR ,
381.Em MONTH ,
382.Em DAY ,
383and
384.Em HH:MM:SS
385fields tell when the leap second happened.
386The
387.Em CORR
388field
389should be
390.Dq \&+
391if a second was added
392or
393.Dq \&-
394if a second was skipped.
395.\" There's no need to document the following, since it's impossible for more
396.\" than one leap second to be inserted or deleted at a time.
397.\" The C Standard is in error in suggesting the possibility.
398.\" See Terry J Quinn, The BIPM and the accurate measure of time,
399.\" Proc IEEE 79, 7 (July 1991), 894-905.
400.\"	or
401.\"	.Dq ++
402.\"	if two seconds were added
403.\"	or
404.\"	.Dq --
405.\"	if two seconds were skipped.
406The
407.Em R/S
408field
409should be (an abbreviation of)
410.Dq Stationary
411if the leap second time given by the other fields should be interpreted as UTC
412or
413(an abbreviation of)
414.Dq Rolling
415if the leap second time given by the other fields should be interpreted as
416local wall clock time.
417.El
418.Sh EXTENDED EXAMPLE
419Here is an extended example of
420.Ic zic
421input, intended to illustrate many of its features.
422.Bl -column -compact "# Rule" "Swiss" "FROM" "1995" "TYPE" "Oct" "lastSun" "1:00u" "SAVE" "LETTER/S"
423.It # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
424.It Rule	Swiss	1941	1942	-	May	Mon>=1	1:00	1:00	S
425.It Rule	Swiss	1941	1942	-	Oct	Mon>=1	2:00	0	-
426.Pp
427.It Rule	EU	1977	1980	-	Apr	Sun>=1	1:00u	1:00	S
428.It Rule	EU	1977	only	-	Sep	lastSun	1:00u	0	-
429.It Rule	EU	1978	only	-	Oct	 1	1:00u	0	-
430.It Rule	EU	1979	1995	-	Sep	lastSun	1:00u	0	-
431.It Rule	EU	1981	max	-	Mar	lastSun	1:00u	1:00	S
432.It Rule	EU	1996	max	-	Oct	lastSun	1:00u	0	-
433.El
434.Pp
435.Bl -column -compact "# Zone" "Europe/Zurich" "0:34:08" "RULES/SAVE" "FORMAT" "UNTIL"
436.It # Zone	NAME	GMTOFF	RULES/SAVE	FORMAT	UNTIL
437.It Zone	Europe/Zurich	0:34:08	-	LMT	1853 Jul 16
438.It 		0:29:44	-	BMT	1894 Jun
439.It 		1:00	Swiss	CE%sT	1981
440.It 		1:00	EU	CE%sT
441.It Link	Europe/Zurich	Switzerland
442.El
443.Pp
444In this example, the zone is named Europe/Zurich but it has an alias
445as Switzerland.
446This example says that Zurich was 34 minutes and 8
447seconds west of UT until 1853-07-16 at 00:00, when the legal offset
448was changed to 7\(de\|26\(fm\|22.50\(sd; although this works out to
4490:29:45.50, the input format cannot represent fractional seconds so it
450is rounded here.
451After 1894-06-01 at 00:00 Swiss daylight saving rules
452(defined with lines beginning with "Rule Swiss") apply, and the UT offset
453became one hour.
454From 1981 to the present, EU daylight saving rules have
455applied, and the UTC offset has remained at one hour.
456.Pp
457In 1941 and 1942, daylight saving time applied from the first Monday
458in May at 01:00 to the first Monday in October at 02:00.
459The pre-1981 EU daylight-saving rules have no effect
460here, but are included for completeness.
461Since 1981, daylight
462saving has begun on the last Sunday in March at 01:00 UTC.
463Until 1995 it ended the last Sunday in September at 01:00 UTC,
464but this changed to the last Sunday in October starting in 1996.
465.Pp
466For purposes of
467display, "LMT" and "BMT" were initially used, respectively.
468Since
469Swiss rules and later EU rules were applied, the display name for the
470time zone has been CET for standard time and CEST for daylight saving
471time.
472.Sh NOTES
473For areas with more than two types of local time,
474you may need to use local standard time in the
475.Em AT
476field of the earliest transition time's rule to ensure that
477the earliest transition time recorded in the compiled file is correct.
478.Pp
479If,
480for a particular zone,
481a clock advance caused by the start of daylight saving
482coincides with and is equal to
483a clock retreat caused by a change in UT offset,
484.Ic zic
485produces a single transition to daylight saving at the new UT offset
486(without any change in wall clock time).
487To get separate transitions
488use multiple zone continuation lines
489specifying transition instants using universal time.
490.Pp
491Time stamps well before the Big Bang are silently omitted from the output.
492This works around bugs in software that mishandles large negative time stamps.
493Call it sour grapes, but pre-Big-Bang time stamps are physically suspect anyway.
494The pre-Big-Bang cutoff time is approximate and may change in future versions.
495.Sh FILES
496.Pa /usr/share/zoneinfo
497- standard directory used for created files
498.Sh SEE ALSO
499.Xr ctime 3 ,
500.Xr tzfile 5 ,
501.Xr zdump 8
502.\" @(#)zic.8	8.6
503.\" This file is in the public domain, so clarified as of
504.\" 2009-05-17 by Arthur David Olson.
505