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