1ZIC(8) System Manager's Manual ZIC(8) 2 3NAME 4 zic - timezone compiler 5 6SYNOPSIS 7 zic [ option ... ] [ filename ... ] 8 9DESCRIPTION 10 The zic program reads text from the file(s) named on the command line 11 and creates the timezone information format (TZif) files specified in 12 this input. If a filename is "-", standard input is read. 13 14OPTIONS 15 --version 16 Output version information and exit. 17 18 --help Output short usage message and exit. 19 20 -b bloat 21 Output backward-compatibility data as specified by bloat. If 22 bloat is fat, generate additional data entries that work around 23 potential bugs or incompatibilities in older software, such as 24 software that mishandles the 64-bit generated data. If bloat is 25 slim, keep the output files small; this can help check for the 26 bugs and incompatibilities. The default is slim, as software 27 that mishandles 64-bit data typically mishandles timestamps 28 after the year 2038 anyway. Also see the -r option for another 29 way to alter output size. 30 31 -d directory 32 Create time conversion information files in the named directory 33 rather than in the standard directory named below. 34 35 -l timezone 36 Use timezone as local time. zic will act as if the input 37 contained a link line of the form 38 39 Link timezone localtime 40 41 If timezone is -, any already-existing link is removed. 42 43 -L leapsecondfilename 44 Read leap second information from the file with the given name. 45 If this option is not used, no leap second information appears 46 in output files. 47 48 -p timezone 49 Use timezone's rules when handling nonstandard TZ strings like 50 "EET-2EEST" that lack transition rules. zic will act as if the 51 input contained a link line of the form 52 53 Link timezone posixrules 54 55 This feature is obsolete and poorly supported. Among other 56 things it should not be used for timestamps after the year 2037, 57 and it should not be combined with -b slim if timezone's 58 transitions are at standard time or Universal Time (UT) instead 59 of local time. 60 61 If timezone is -, any already-existing link is removed. 62 63 -r [@lo][/@hi] 64 Limit the applicability of output files to timestamps in the 65 range from lo (inclusive) to hi (exclusive), where lo and hi are 66 possibly-signed decimal counts of seconds since the Epoch 67 (1970-01-01 00:00:00 UTC). Omitted counts default to extreme 68 values. The output files use UT offset 0 and abbreviation "-00" 69 in place of the omitted timestamp data; this typically reduces 70 the files' sizes. For example, "zic -r @0" omits data intended 71 for negative timestamps (i.e., before the Epoch), and "zic -r 72 @0/@2147483648" outputs data intended only for nonnegative 73 timestamps that fit into 31-bit signed integers. On platforms 74 with GNU date, "zic -r @$(date +%s)" omits data intended for 75 past timestamps. Also see the -b slim option for another way to 76 shrink output size. 77 78 -t file 79 When creating local time information, put the configuration link 80 in the named file rather than in the standard location. 81 82 -v Be more verbose, and complain about the following situations: 83 84 The input specifies a link to a link. 85 86 A year that appears in a data file is outside the range of 87 representable years. 88 89 A time of 24:00 or more appears in the input. Pre-1998 versions 90 of zic prohibit 24:00, and pre-2007 versions prohibit times 91 greater than 24:00. 92 93 A rule goes past the start or end of the month. Pre-2004 94 versions of zic prohibit this. 95 96 A time zone abbreviation uses a %z format. Pre-2015 versions of 97 zic do not support this. 98 99 A timestamp contains fractional seconds. Pre-2018 versions of 100 zic do not support this. 101 102 The input contains abbreviations that are mishandled by pre-2018 103 versions of zic due to a longstanding coding bug. These 104 abbreviations include "L" for "Link", "mi" for "min", "Sa" for 105 "Sat", and "Su" for "Sun". 106 107 The output file does not contain all the information about the 108 long-term future of a timezone, because the future cannot be 109 summarized as an extended POSIX TZ string. For example, as of 110 2019 this problem occurs for Iran's daylight-saving rules for 111 the predicted future, as these rules are based on the Iranian 112 calendar, which cannot be represented. 113 114 The output contains data that may not be handled properly by 115 client code designed for older zic output formats. These 116 compatibility issues affect only timestamps before 1970 or after 117 the start of 2038. 118 119 The output contains a truncated leap second table, which can 120 cause some older TZif readers to misbehave. This can occur if 121 the -L option is used, and either an Expires line is present or 122 the -r option is also used. 123 124 The output file contains more than 1200 transitions, which may 125 be mishandled by some clients. The current reference client 126 supports at most 2000 transitions; pre-2014 versions of the 127 reference client support at most 1200 transitions. 128 129 A time zone abbreviation has fewer than 3 or more than 6 130 characters. POSIX requires at least 3, and requires 131 implementations to support at least 6. 132 133 An output file name contains a byte that is not an ASCII letter, 134 "-", "/", or "_"; or it contains a file name component that 135 contains more than 14 bytes or that starts with "-". 136 137FILES 138 Input files use the format described in this section; output files use 139 tzfile(5) format. 140 141 Input files should be text files, that is, they should be a series of 142 zero or more lines, each ending in a newline byte and containing at 143 most 511 bytes, and without any NUL bytes. The input text's encoding 144 is typically UTF-8 or ASCII; it should have a unibyte representation 145 for the POSIX Portable Character Set (PPCS) <https://pubs.opengroup 146 .org/onlinepubs/9699919799/basedefs/V1_chap06.html> and the encoding's 147 non-unibyte characters should consist entirely of non-PPCS bytes. Non- 148 PPCS characters typically occur only in comments: although output file 149 names and time zone abbreviations can contain nearly any character, 150 other software will work better if these are limited to the restricted 151 syntax described under the -v option. 152 153 Input lines are made up of fields. Fields are separated from one 154 another by one or more white space characters. The white space 155 characters are space, form feed, carriage return, newline, tab, and 156 vertical tab. Leading and trailing white space on input lines is 157 ignored. An unquoted sharp character (#) in the input introduces a 158 comment which extends to the end of the line the sharp character 159 appears on. White space characters and sharp characters may be 160 enclosed in double quotes (") if they're to be used as part of a field. 161 Any line that is blank (after comment stripping) is ignored. Nonblank 162 lines are expected to be of one of three types: rule lines, zone lines, 163 and link lines. 164 165 Names must be in English and are case insensitive. They appear in 166 several contexts, and include month and weekday names and keywords such 167 as maximum, only, Rolling, and Zone. A name can be abbreviated by 168 omitting all but an initial prefix; any abbreviation must be 169 unambiguous in context. 170 171 A rule line has the form 172 173 Rule NAME FROM TO - IN ON AT SAVE LETTER/S 174 175 For example: 176 177 Rule US 1967 1973 - Apr lastSun 2:00w 1:00d D 178 179 The fields that make up a rule line are: 180 181 NAME Gives the name of the rule set that contains this line. The 182 name must start with a character that is neither an ASCII digit 183 nor "-" nor "+". To allow for future extensions, an unquoted 184 name should not contain characters from the set 185 "!$%&'()*,/:;<=>?@[\]^`{|}~". 186 187 FROM Gives the first year in which the rule applies. Any signed 188 integer year can be supplied; the proleptic Gregorian calendar 189 is assumed, with year 0 preceding year 1. The word minimum (or 190 an abbreviation) means the indefinite past. The word maximum 191 (or an abbreviation) means the indefinite future. Rules can 192 describe times that are not representable as time values, with 193 the unrepresentable times ignored; this allows rules to be 194 portable among hosts with differing time value types. 195 196 TO Gives the final year in which the rule applies. In addition to 197 minimum and maximum (as above), the word only (or an 198 abbreviation) may be used to repeat the value of the FROM 199 field. 200 201 - Is a reserved field and should always contain "-" for 202 compatibility with older versions of zic. It was previously 203 known as the TYPE field, which could contain values to allow a 204 separate script to further restrict in which "types" of years 205 the rule would apply. 206 207 IN Names the month in which the rule takes effect. Month names 208 may be abbreviated. 209 210 ON Gives the day on which the rule takes effect. Recognized forms 211 include: 212 213 5 the fifth of the month 214 lastSun the last Sunday in the month 215 lastMon the last Monday in the month 216 Sun>=8 first Sunday on or after the eighth 217 Sun<=25 last Sunday on or before the 25th 218 219 A weekday name (e.g., Sunday) or a weekday name preceded by 220 "last" (e.g., lastSunday) may be abbreviated or spelled out in 221 full. There must be no white space characters within the ON 222 field. The "<=" and ">=" constructs can result in a day in the 223 neighboring month; for example, the IN-ON combination "Oct 224 Sun>=31" stands for the first Sunday on or after October 31, 225 even if that Sunday occurs in November. 226 227 AT Gives the time of day at which the rule takes effect, relative 228 to 00:00, the start of a calendar day. Recognized forms 229 include: 230 231 2 time in hours 232 2:00 time in hours and minutes 233 01:28:14 time in hours, minutes, and seconds 234 00:19:32.13 time with fractional seconds 235 12:00 midday, 12 hours after 00:00 236 15:00 3 PM, 15 hours after 00:00 237 24:00 end of day, 24 hours after 00:00 238 260:00 260 hours after 00:00 239 -2:30 2.5 hours before 00:00 240 - equivalent to 0 241 242 Although zic rounds times to the nearest integer second 243 (breaking ties to the even integer), the fractions may be 244 useful to other applications requiring greater precision. The 245 source format does not specify any maximum precision. Any of 246 these forms may be followed by the letter w if the given time 247 is local or "wall clock" time, s if the given time is standard 248 time without any adjustment for daylight saving, or u (or g or 249 z) if the given time is universal time; in the absence of an 250 indicator, local (wall clock) time is assumed. These forms 251 ignore leap seconds; for example, if a leap second occurs at 252 00:59:60 local time, "1:00" stands for 3601 seconds after local 253 midnight instead of the usual 3600 seconds. The intent is that 254 a rule line describes the instants when a clock/calendar set to 255 the type of time specified in the AT field would show the 256 specified date and time of day. 257 258 SAVE Gives the amount of time to be added to local standard time 259 when the rule is in effect, and whether the resulting time is 260 standard or daylight saving. This field has the same format as 261 the AT field except with a different set of suffix letters: s 262 for standard time and d for daylight saving time. The suffix 263 letter is typically omitted, and defaults to s if the offset is 264 zero and to d otherwise. Negative offsets are allowed; in 265 Ireland, for example, daylight saving time is observed in 266 winter and has a negative offset relative to Irish Standard 267 Time. The offset is merely added to standard time; for 268 example, zic does not distinguish a 10:30 standard time plus an 269 0:30 SAVE from a 10:00 standard time plus a 1:00 SAVE. 270 271 LETTER/S 272 Gives the "variable part" (for example, the "S" or "D" in "EST" 273 or "EDT") of time zone abbreviations to be used when this rule 274 is in effect. If this field is "-", the variable part is null. 275 276 A zone line has the form 277 278 Zone NAME STDOFF RULES FORMAT [UNTIL] 279 280 For example: 281 282 Zone Asia/Amman 2:00 Jordan EE%sT 2017 Oct 27 01:00 283 284 The fields that make up a zone line are: 285 286 NAME The name of the timezone. This is the name used in creating the 287 time conversion information file for the timezone. It should not 288 contain a file name component "." or ".."; a file name component 289 is a maximal substring that does not contain "/". 290 291 STDOFF 292 The amount of time to add to UT to get standard time, without any 293 adjustment for daylight saving. This field has the same format 294 as the AT and SAVE fields of rule lines; begin the field with a 295 minus sign if time must be subtracted from UT. 296 297 RULES The name of the rules that apply in the timezone or, 298 alternatively, a field in the same format as a rule-line SAVE 299 column, giving the amount of time to be added to local standard 300 time and whether the resulting time is standard or daylight 301 saving. If this field is - then standard time always applies. 302 When an amount of time is given, only the sum of standard time 303 and this amount matters. 304 305 FORMAT 306 The format for time zone abbreviations. The pair of characters 307 %s is used to show where the "variable part" of the time zone 308 abbreviation goes. Alternatively, a format can use the pair of 309 characters %z to stand for the UT offset in the form +-hh, 310 +-hhmm, or +-hhmmss, using the shortest form that does not lose 311 information, where hh, mm, and ss are the hours, minutes, and 312 seconds east (+) or west (-) of UT. Alternatively, a slash (/) 313 separates standard and daylight abbreviations. To conform to 314 POSIX, a time zone abbreviation should contain only alphanumeric 315 ASCII characters, "+" and "-". By convention, the time zone 316 abbreviation "-00" is a placeholder that means local time is 317 unspecified. 318 319 UNTIL The time at which the UT offset or the rule(s) change for a 320 location. It takes the form of one to four fields YEAR [MONTH 321 [DAY [TIME]]]. If this is specified, the time zone information 322 is generated from the given UT offset and rule change until the 323 time specified, which is interpreted using the rules in effect 324 just before the transition. The month, day, and time of day have 325 the same format as the IN, ON, and AT fields of a rule; trailing 326 fields can be omitted, and default to the earliest possible value 327 for the missing fields. 328 329 The next line must be a "continuation" line; this has the same 330 form as a zone line except that the string "Zone" and the name 331 are omitted, as the continuation line will place information 332 starting at the time specified as the "until" information in the 333 previous line in the file used by the previous line. 334 Continuation lines may contain "until" information, just as zone 335 lines do, indicating that the next line is a further 336 continuation. 337 338 If a zone changes at the same instant that a rule would otherwise take 339 effect in the earlier zone or continuation line, the rule is ignored. 340 A zone or continuation line L with a named rule set starts with 341 standard time by default: that is, any of L's timestamps preceding L's 342 earliest rule use the rule in effect after L's first transition into 343 standard time. In a single zone it is an error if two rules take 344 effect at the same instant, or if two zone changes take effect at the 345 same instant. 346 347 If a continuation line subtracts N seconds from the UT offset after a 348 transition that would be interpreted to be later if using the 349 continuation line's UT offset and rules, the "until" time of the 350 previous zone or continuation line is interpreted according to the 351 continuation line's UT offset and rules, and any rule that would 352 otherwise take effect in the next N seconds is instead assumed to take 353 effect simultaneously. For example: 354 355 # Rule NAME FROM TO - IN ON AT SAVE LETTER/S 356 Rule US 1967 2006 - Oct lastSun 2:00 0 S 357 Rule US 1967 1973 - Apr lastSun 2:00 1:00 D 358 # Zone NAME STDOFF RULES FORMAT [UNTIL] 359 Zone America/Menominee -5:00 - EST 1973 Apr 29 2:00 360 -6:00 US C%sT 361 362 Here, an incorrect reading would be there were two clock changes on 363 1973-04-29, the first from 02:00 EST (-05) to 01:00 CST (-06), and the 364 second an hour later from 02:00 CST (-06) to 03:00 CDT (-05). However, 365 zic interprets this more sensibly as a single transition from 02:00 CST 366 (-05) to 02:00 CDT (-05). 367 368 A link line has the form 369 370 Link TARGET LINK-NAME 371 372 For example: 373 374 Link Europe/Istanbul Asia/Istanbul 375 376 The TARGET field should appear as the NAME field in some zone line. 377 The LINK-NAME field is used as an alternative name for that zone; it 378 has the same syntax as a zone line's NAME field. 379 380 Except for continuation lines, lines may appear in any order in the 381 input. However, the behavior is unspecified if multiple zone or link 382 lines define the same name, or if the source of one link line is the 383 target of another. 384 385 The file that describes leap seconds can have leap lines and an 386 expiration line. Leap lines have the following form: 387 388 Leap YEAR MONTH DAY HH:MM:SS CORR R/S 389 390 For example: 391 392 Leap 2016 Dec 31 23:59:60 + S 393 394 The YEAR, MONTH, DAY, and HH:MM:SS fields tell when the leap second 395 happened. The CORR field should be "+" if a second was added or "-" if 396 a second was skipped. The R/S field should be (an abbreviation of) 397 "Stationary" if the leap second time given by the other fields should 398 be interpreted as UTC or (an abbreviation of) "Rolling" if the leap 399 second time given by the other fields should be interpreted as local 400 (wall clock) time. 401 402 Rolling leap seconds were implemented back when it was not clear 403 whether common practice was rolling or stationary, with concerns that 404 one would see Times Square ball drops where there'd be a "3... 2... 405 1... leap... Happy New Year" countdown, placing the leap second at 406 midnight New York time rather than midnight UTC. However, this 407 countdown style does not seem to have caught on, which means rolling 408 leap seconds are not used in practice; also, they are not supported if 409 the -r option is used. 410 411 The expiration line, if present, has the form: 412 413 Expires YEAR MONTH DAY HH:MM:SS 414 415 For example: 416 417 Expires 2020 Dec 28 00:00:00 418 419 The YEAR, MONTH, DAY, and HH:MM:SS fields give the expiration timestamp 420 in UTC for the leap second table; 421 422EXTENDED EXAMPLE 423 Here is an extended example of zic input, intended to illustrate many 424 of its features. In this example, the EU rules are for the European 425 Union and for its predecessor organization, the European Communities. 426 427 # Rule NAME FROM TO - IN ON AT SAVE LETTER/S 428 Rule Swiss 1941 1942 - May Mon>=1 1:00 1:00 S 429 Rule Swiss 1941 1942 - Oct Mon>=1 2:00 0 - 430 Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S 431 Rule EU 1977 only - Sep lastSun 1:00u 0 - 432 Rule EU 1978 only - Oct 1 1:00u 0 - 433 Rule EU 1979 1995 - Sep lastSun 1:00u 0 - 434 Rule EU 1981 max - Mar lastSun 1:00u 1:00 S 435 Rule EU 1996 max - Oct lastSun 1:00u 0 - 436 437 # Zone NAME STDOFF RULES FORMAT [UNTIL] 438 Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 439 0:29:45.50 - BMT 1894 Jun 440 1:00 Swiss CE%sT 1981 441 1:00 EU CE%sT 442 443 Link Europe/Zurich Europe/Vaduz 444 445 In this example, the timezone is named Europe/Zurich but it has an 446 alias as Europe/Vaduz. This example says that Zurich was 34 minutes 447 and 8 seconds east of UT until 1853-07-16 at 00:00, when the legal 448 offset was changed to 7<degree>26'22.50'', which works out to 449 0:29:45.50; zic treats this by rounding it to 0:29:46. After 450 1894-06-01 at 00:00 the UT offset became one hour and Swiss daylight 451 saving rules (defined with lines beginning with "Rule Swiss") apply. 452 From 1981 to the present, EU daylight saving rules have applied, and 453 the UTC offset has remained at one hour. 454 455 In 1941 and 1942, daylight saving time applied from the first Monday in 456 May at 01:00 to the first Monday in October at 02:00. The pre-1981 EU 457 daylight-saving rules have no effect here, but are included for 458 completeness. Since 1981, daylight saving has begun on the last Sunday 459 in March at 01:00 UTC. Until 1995 it ended the last Sunday in 460 September at 01:00 UTC, but this changed to the last Sunday in October 461 starting in 1996. 462 463 For purposes of display, "LMT" and "BMT" were initially used, 464 respectively. Since Swiss rules and later EU rules were applied, the 465 time zone abbreviation has been CET for standard time and CEST for 466 daylight saving time. 467 468FILES 469 /etc/localtime 470 Default local timezone file. 471 472 /usr/share/zoneinfo 473 Default timezone information directory. 474 475NOTES 476 For areas with more than two types of local time, you may need to use 477 local standard time in the AT field of the earliest transition time's 478 rule to ensure that the earliest transition time recorded in the 479 compiled file is correct. 480 481 If, for a particular timezone, a clock advance caused by the start of 482 daylight saving coincides with and is equal to a clock retreat caused 483 by a change in UT offset, zic produces a single transition to daylight 484 saving at the new UT offset without any change in local (wall clock) 485 time. To get separate transitions use multiple zone continuation lines 486 specifying transition instants using universal time. 487 488SEE ALSO 489 tzfile(5), zdump(8) 490 491 ZIC(8) 492