strftime.3: wfix
[man-pages.git] / man8 / zic.8
blob157fe0982f143e5b54607b750e670d0451b12074
1 .\" %%%LICENSE_START(PUBLIC_DOMAIN)
2 .\" This page is in the public domain
3 .\" %%%LICENSE_END
4 .\"
5 .TH ZIC 8 2019-03-06 "" "Linux System Administration"
6 .SH NAME
7 zic \- timezone compiler
8 .SH SYNOPSIS
9 .B zic
11 .I option
12 \&... ] [
13 .I filename
14 \&... ]
15 .SH DESCRIPTION
16 .ie '\(lq'' .ds lq \&"\"
17 .el .ds lq \(lq\"
18 .ie '\(rq'' .ds rq \&"\"
19 .el .ds rq \(rq\"
20 .de q
21 \\$3\*(lq\\$1\*(rq\\$2
23 .ie '\(la'' .ds < <
24 .el .ds < \(la
25 .ie '\(ra'' .ds > >
26 .el .ds > \(ra
27 .ie \n(.g \{\
28 .  ds : \:
29 .  ds - \f(CW-\fP
30 .\}
31 .el \{\
32 .  ds :
33 .  ds - \-
34 .\}
35 The
36 .B zic
37 program reads text from the file(s) named on the command line
38 and creates the time conversion information files specified in this input.
39 If a
40 .I filename
42 .q "\*-" ,
43 standard input is read.
44 .SH OPTIONS
45 .TP
46 .B "\*-\*-version"
47 Output version information and exit.
48 .TP
49 .B \*-\*-help
50 Output short usage message and exit.
51 .TP
52 .BI "\*-d " directory
53 Create time conversion information files in the named directory rather than
54 in the standard directory named below.
55 .TP
56 .BI "\*-l " timezone
57 Use
58 .I timezone
59 as local time.
60 .B zic
61 will act as if the input contained a link line of the form
62 .sp
63 .ti +.5i
64 Link    \fItimezone\fP          localtime
65 .TP
66 .BI "\*-p " timezone
67 Use
68 .IR timezone 's
69 rules when handling POSIX-format
70 timezone environment variables.
71 .B zic
72 will act as if the input contained a link line of the form
73 .sp
74 .ti +.5i
75 Link    \fItimezone\fP          posixrules
76 .TP
77 .BI "\*-L " leapsecondfilename
78 Read leap second information from the file with the given name.
79 If this option is not used,
80 no leap second information appears in output files.
81 .TP
82 .B \*-v
83 Be more verbose, and complain about the following situations:
84 .RS
85 .PP
86 The input specifies a link to a link.
87 .PP
88 A year that appears in a data file is outside the range
89 of years representable by
90 .BR time (2)
91 values.
92 .PP
93 A time of 24:00 or more appears in the input.
94 Pre-1998 versions of
95 .B zic
96 prohibit 24:00, and pre-2007 versions prohibit times greater than 24:00.
97 .PP
98 A rule goes past the start or end of the month.
99 Pre-2004 versions of
100 .B zic
101 prohibit this.
103 The output file does not contain all the information about the
104 long-term future of a timezone, because the future cannot be summarized as
105 an extended POSIX TZ string.  For example, as of 2013 this problem
106 occurs for Iran's daylight-saving rules for the predicted future, as
107 these rules are based on the Iranian calendar, which cannot be
108 represented.
110 The output contains data that may not be handled properly by client
111 code designed for older
112 .B zic
113 output formats.  These compatibility issues affect only timestamps
114 before 1970 or after the start of 2038.
116 A time zone abbreviation has fewer than 3 characters.
117 POSIX requires at least 3.
119 An output file name contains a byte that is not an ASCII letter,
120 .q "\*-" ,
121 .q "/" ,
123 .q "_" ;
124 or it contains a file name component that contains more than 14 bytes
125 or that starts with
126 .q "\*-" .
129 .B \*-s
130 Limit time values stored in output files to values that are the same
131 whether they're taken to be signed or unsigned.
132 You can use this option to generate SVVS-compatible files.
134 Input files should be text files, that is, they should be a series of
135 zero or more lines, each ending in a newline byte and containing at
136 most 511 bytes, and without any NUL bytes.  The input text's encoding
137 is typically UTF-8 or ASCII; it should have a unibyte representation
138 for the POSIX Portable Character Set (PPCS)
139 \*<http://pubs\*:.opengroup\*:.org/\*:onlinepubs/\*:9699919799/\*:basedefs/\*:V1_chap06\*:.html\*>
140 and the encoding's non-unibyte characters should consist entirely of
141 non-PPCS bytes.  Non-PPCS characters typically occur only in comments:
142 although output file names and time zone abbreviations can contain
143 nearly any character, other software will work better if these are
144 limited to the restricted syntax described under the
145 .B \*-v
146 option.
148 Input lines are made up of fields.
149 Fields are separated from one another by one or more white space characters.
150 The white space characters are space, form feed, carriage return, newline,
151 tab, and vertical tab.
152 Leading and trailing white space on input lines is ignored.
153 An unquoted sharp character (#) in the input introduces a comment which extends
154 to the end of the line the sharp character appears on.
155 White space characters and sharp characters may be enclosed in double quotes
156 (") if they're to be used as part of a field.
157 Any line that is blank (after comment stripping) is ignored.
158 Nonblank lines are expected to be of one of three types:
159 rule lines, zone lines, and link lines.
161 Names must be in English and are case insensitive.
162 They appear in several contexts, and include month and weekday names
163 and keywords such as
164 .BR "maximum" ,
165 .BR "only" ,
166 .BR "Rolling" ,
168 .BR "Zone" .
169 A name can be abbreviated by omitting all but an initial prefix; any
170 abbreviation must be unambiguous in context.
172 A rule line has the form
174 .ti +.5i
175 .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:00w\0\0'u +\w'1:00d\0\0'u
177 Rule    NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
179 For example:
180 .ti +.5i
182 Rule    US      1967    1973    \*-     Apr     lastSun 2:00w   1:00    D
185 The fields that make up a rule line are:
186 .TP "\w'LETTER/S'u"
187 .B NAME
188 Gives the name of the rule set that contains this line.
189 The name must start with a character that is neither
190 an ASCII digit nor
191 .q \*-
193 .q + .
194 To allow for future extensions,
195 an unquoted name should not contain characters from the set
196 .q !$%&'()*,/:;<=>?@[\e]^`{|}~ .
198 .B FROM
199 Gives the first year in which the rule applies.
200 Any signed integer year can be supplied; the proleptic Gregorian calendar
201 is assumed, with year 0 preceding year 1.
202 The word
203 .B minimum
204 (or an abbreviation) means the indefinite past.
205 The word
206 .B maximum
207 (or an abbreviation) means the indefinite future.
208 Rules can describe times that are not representable as time values,
209 with the unrepresentable times ignored; this allows rules to be portable
210 among hosts with differing time value types.
212 .B TO
213 Gives the final year in which the rule applies.
214 In addition to
215 .B minimum
217 .B maximum
218 (as above),
219 the word
220 .B only
221 (or an abbreviation)
222 may be used to repeat the value of the
223 .B FROM
224 field.
226 .B TYPE
227 should be
228 .q \*-
229 and is present for compatibility with older versions of
230 .B zic
231 in which it could contain year types.
233 .B IN
234 Names the month in which the rule takes effect.
235 Month names may be abbreviated.
237 .B ON
238 Gives the day on which the rule takes effect.
239 Recognized forms include:
241 .in +.5i
243 .ta \w'Sun<=25\0\0'u
244 5       the fifth of the month
245 lastSun the last Sunday in the month
246 lastMon the last Monday in the month
247 Sun>=8  first Sunday on or after the eighth
248 Sun<=25 last Sunday on or before the 25th
250 .in -.5i
252 A weekday name (e.g.,
253 .BR "Sunday" )
254 or a weekday name preceded by
255 .q "last"
256 (e.g.,
257 .BR "lastSunday" )
258 may be abbreviated or spelled out in full.
259 Note that there must be no spaces within the
260 .B ON
261 field.
263 .B AT
264 Gives the time of day at which the rule takes effect.
265 Recognized forms include:
267 .in +.5i
269 .ta \w'00:19:32.13\0\0'u
270 2       time in hours
271 2:00    time in hours and minutes
272 01:28:14        time in hours, minutes, and seconds
273 15:00   24-hour format time (for times after noon)
274 260:00  260 hours after 00:00
275 \*-2:30 2.5 hours before 00:00
276 \*-     equivalent to 0
278 .in -.5i
280 where hour 0 is midnight at the start of the day,
281 and hour 24 is midnight at the end of the day.
282 Any of these forms may be followed by the letter
283 .B w
284 if the given time is local
285 .q "wall clock"
286 time,
287 .B s
288 if the given time is local
289 .q "standard"
290 time, or
291 .B u
293 .B g
295 .BR z )
296 if the given time is universal time;
297 in the absence of an indicator,
298 wall clock time is assumed.
299 The intent is that a rule line describes the instants when a
300 clock/calendar set to the type of time specified in the
301 .B AT
302 field would show the specified date and time of day.
304 .B SAVE
305 Gives the amount of time to be added to local standard time when the rule is in
306 effect.
307 This field has the same format as the
308 .B AT
309 field
310 (although, of course, the
311 .B w
313 .B s
314 suffixes are not used).
315 Negative offsets are allowed; in Ireland, for example, daylight saving
316 time is observed in winter and has a negative offset relative to
317 Irish Standard Time.
318 The offset is merely added to standard time; for example,
319 .B zic
320 does not distinguish a 10:30 standard time plus an 0:30
321 .B SAVE
322 from a 10:00 standard time plus a 1:00
323 .BR SAVE .
325 .B LETTER/S
326 Gives the
327 .q "variable part"
328 (for example, the
329 .q "S"
331 .q "D"
333 .q "EST"
335 .q "EDT" )
336 of time zone abbreviations to be used when this rule is in effect.
337 If this field is
338 .q \*- ,
339 the variable part is null.
341 A zone line has the form
344 .ti +.5i
345 .ta \w'Zone\0\0'u +\w'Asia/Amman\0\0'u +\w'UTOFF\0\0'u +\w'Jordan\0\0'u +\w'FORMAT\0\0'u
346 Zone    NAME    UTOFF   RULES   FORMAT  [UNTIL]
348 For example:
350 .ti +.5i
351 Zone    Asia/Amman      2:00    Jordan  EE%sT   2017 Oct 27 01:00
354 The fields that make up a zone line are:
355 .TP "\w'UTOFF'u"
356 .B NAME
357 The name of the timezone.
358 This is the name used in creating the time conversion information file for the
359 timezone.
360 It should not contain a file name component
361 .q ".\&"
363 .q ".." ;
364 a file name component is a maximal substring that does not contain
365 .q "/" .
367 .B UTOFF
368 The amount of time to add to UT to get standard time.
369 This field has the same format as the
370 .B AT
372 .B SAVE
373 fields of rule lines;
374 begin the field with a minus sign if time must be subtracted from UT.
376 .B RULES
377 The name of the rules that apply in the timezone or,
378 alternatively, a field in the same format as a rule-line SAVE column,
379 giving of the amount of time to be added to local standard time
380 effect, and whether the resulting time is standard or daylight saving.
381 If this field is
382 .B \*-
383 then standard time always applies.
384 When an amount of time is given, only the sum of standard time and
385 this amount matters.
387 .B FORMAT
388 The format for time zone abbreviations.
389 The pair of characters
390 .B %s
391 is used to show where the
392 .q "variable part"
393 of the time zone abbreviation goes.
394 Alternatively, a format can use the pair of characters
395 .B %z
396 to stand for the UT offset in the form
397 .RI \(+- hh ,
398 .RI \(+- hhmm ,
400 .RI \(+- hhmmss ,
401 using the shortest form that does not lose information, where
402 .IR hh ,
403 .IR mm ,
405 .I ss
406 are the hours, minutes, and seconds east (+) or west (\(mi) of UT.
407 Alternatively,
408 a slash (/)
409 separates standard and daylight abbreviations.
410 To conform to POSIX, a time zone abbreviation should contain only
411 alphanumeric ASCII characters,
412 .q "+"
414 .q "\*-".
416 .B UNTIL
417 The time at which the UT offset or the rule(s) change for a location.
418 It takes the form of YEAR [MONTH [DAY [TIME]]].
419 If this is specified,
420 the time zone information is generated from the given UT offset
421 and rule change until the time specified, which is interpreted using
422 the rules in effect just before the transition.
423 The month, day, and time of day have the same format as the IN, ON, and AT
424 fields of a rule; trailing fields can be omitted, and default to the
425 earliest possible value for the missing fields.
427 The next line must be a
428 .q "continuation"
429 line; this has the same form as a zone line except that the
430 string
431 .q "Zone"
432 and the name are omitted, as the continuation line will
433 place information starting at the time specified as the
434 .q "until"
435 information in the previous line in the file used by the previous line.
436 Continuation lines may contain
437 .q "until"
438 information, just as zone lines do, indicating that the next line is a further
439 continuation.
441 If a zone changes at the same instant that a rule would otherwise take
442 effect in the earlier zone or continuation line, the rule is ignored.
443 In a single zone it is an error if two rules take effect at the same
444 instant, or if two zone changes take effect at the same instant.
446 A link line has the form
449 .ti +.5i
450 .ta \w'Link\0\0'u +\w'Europe/Istanbul\0\0'u
451 Link    TARGET  LINK-NAME
453 For example:
455 .ti +.5i
456 Link    Europe/Istanbul Asia/Istanbul
460 .B TARGET
461 field should appear as the
462 .B NAME
463 field in some zone line.
465 .B LINK-NAME
466 field is used as an alternative name for that zone;
467 it has the same syntax as a zone line's
468 .B NAME
469 field.
471 Except for continuation lines,
472 lines may appear in any order in the input.
473 However, the behavior is unspecified if multiple zone or link lines
474 define the same name, or if the source of one link line is the target
475 of another.
477 Lines in the file that describes leap seconds have the following form:
479 .ti +.5i
480 .ta \w'Leap\0\0'u +\w'YEAR\0\0'u +\w'MONTH\0\0'u +\w'DAY\0\0'u +\w'HH:MM:SS\0\0'u +\w'CORR\0\0'u
482 Leap    YEAR    MONTH   DAY     HH:MM:SS        CORR    R/S
484 For example:
485 .ti +.5i
487 Leap    2016    Dec     31      23:59:60        +       S
491 .BR YEAR ,
492 .BR MONTH ,
493 .BR DAY ,
495 .B HH:MM:SS
496 fields tell when the leap second happened.
498 .B CORR
499 field
500 should be
501 .q "+"
502 if a second was added
504 .q "\*-"
505 if a second was skipped.
507 .B R/S
508 field
509 should be (an abbreviation of)
510 .q "Stationary"
511 if the leap second time given by the other fields should be interpreted as UTC
513 (an abbreviation of)
514 .q "Rolling"
515 if the leap second time given by the other fields should be interpreted as
516 local wall clock time.
517 .SH "EXTENDED EXAMPLE"
518 Here is an extended example of
519 .B zic
520 input, intended to illustrate many of its features.
521 In this example, the EU rules are for the European Union
522 and for its predecessor organization, the European Communities.
524 .ne 22
526 .in +2m
527 .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
529 # Rule  NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
530 Rule    Swiss   1941    1942    \*-     May     Mon>=1  1:00    1:00    S
531 Rule    Swiss   1941    1942    \*-     Oct     Mon>=1  2:00    0       \*-
532 .sp .5
533 Rule    EU      1977    1980    \*-     Apr     Sun>=1  1:00u   1:00    S
534 Rule    EU      1977    only    \*-     Sep     lastSun 1:00u   0       \*-
535 Rule    EU      1978    only    \*-     Oct      1      1:00u   0       \*-
536 Rule    EU      1979    1995    \*-     Sep     lastSun 1:00u   0       \*-
537 Rule    EU      1981    max     \*-     Mar     lastSun 1:00u   1:00    S
538 Rule    EU      1996    max     \*-     Oct     lastSun 1:00u   0       \*-
540 .ta \w'# Zone\0\0'u +\w'Europe/Zurich\0\0'u +\w'0:34:08\0\0'u +\w'RULES\0\0'u +\w'FORMAT\0\0'u
541 # Zone  NAME    UTOFF   RULES   FORMAT  [UNTIL]
542 Zone    Europe/Zurich   0:34:08 \*-     LMT     1853 Jul 16
543                 0:29:46 \*-     BMT     1894 Jun
544                 1:00    Swiss   CE%sT   1981
545                 1:00    EU      CE%sT
547 Link    Europe/Zurich   Europe/Vaduz
551 In this example, the timezone is named Europe/Zurich but it has an alias
552 as Europe/Vaduz.  This example says that Zurich was 34 minutes and 8
553 seconds east of UT until 1853-07-16 at 00:00, when the legal offset
554 was changed to 7\(de\|26\(fm\|22.50\(sd; although this works out to
555 0:29:45.50, the input format cannot represent fractional seconds so it
556 is rounded here.  After 1894-06-01 at 00:00 the UT offset became one hour
557 and Swiss daylight saving rules (defined with lines beginning with
558 .q "Rule Swiss")
559 apply.  From 1981 to the present, EU daylight saving rules have
560 applied, and the UTC offset has remained at one hour.
562 In 1941 and 1942, daylight saving time applied from the first Monday
563 in May at 01:00 to the first Monday in October at 02:00.
564 The pre-1981 EU daylight-saving rules have no effect
565 here, but are included for completeness.  Since 1981, daylight
566 saving has begun on the last Sunday in March at 01:00 UTC.
567 Until 1995 it ended the last Sunday in September at 01:00 UTC,
568 but this changed to the last Sunday in October starting in 1996.
570 For purposes of display,
571 .q "LMT"
573 .q "BMT"
574 were initially used, respectively.  Since
575 Swiss rules and later EU rules were applied, the time zone abbreviation
576 has been CET for standard time and CEST for daylight saving
577 time.
578 .SH FILES
580 .I /etc/localtime
581 Default local timezone file.
583 .I /usr/share/zoneinfo
584 Default timezone information directory.
585 .SH NOTES
586 For areas with more than two types of local time,
587 you may need to use local standard time in the
588 .B AT
589 field of the earliest transition time's rule to ensure that
590 the earliest transition time recorded in the compiled file is correct.
593 for a particular timezone,
594 a clock advance caused by the start of daylight saving
595 coincides with and is equal to
596 a clock retreat caused by a change in UT offset,
597 .B zic
598 produces a single transition to daylight saving at the new UT offset
599 (without any change in wall clock time).
600 To get separate transitions
601 use multiple zone continuation lines
602 specifying transition instants using universal time.
603 .SH SEE ALSO
604 .BR tzfile (5),
605 .BR zdump (8)
606 .\" This file is in the public domain, so clarified as of
607 .\" 2009-05-17 by Arthur David Olson.