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