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 March 22, 2010 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 123Names (such as month names) must be in English and are case insensitive. 124Abbreviations, if used, must be unambiguous in context. 125.Pp 126A rule line has the form: 127.Dl "Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S" 128For example: 129.Dl "Rule US 1967 1973 \- Apr lastSun 2:00 1:00 D" 130.Pp 131The fields that make up a rule line are: 132.Bl -tag -width "LETTER/S" -offset indent 133.It NAME 134Give the (arbitrary) name of the set of rules this rule is part of. 135.It FROM 136Give the first year in which the rule applies. 137Any integer year can be supplied; the Gregorian calendar is assumed. 138The word 139.Em minimum 140(or an abbreviation) means the minimum year representable as an integer. 141The word 142.Em maximum 143(or an abbreviation) means the maximum year representable as an integer. 144Rules can describe times that are not representable as time values, 145with the unrepresentable times ignored; this allows rules to be portable 146among hosts with differing time value types. 147.It TO 148Give the final year in which the rule applies. 149In addition to 150.Em minimum 151and 152.Em maximum 153(as above), 154the word 155.Em only 156(or an abbreviation) 157may be used to repeat the value of the 158.Em FROM 159field. 160.It TYPE 161Give the type of year in which the rule applies. 162If 163.Em TYPE 164is 165.Em \- 166then the rule applies in all years between 167.Em FROM 168and 169.Em TO 170inclusive. 171If 172.Em TYPE 173is something else, then 174.Nm 175executes the command 176.Li yearistype Ar year Ar type 177to check the type of a year: 178an exit status of zero is taken to mean that the year is of the given type; 179an exit status of one is taken to mean that the year is not of the given type. 180.It IN 181Name the month in which the rule takes effect. 182Month names may be abbreviated. 183.It ON 184Give the day on which the rule takes effect. 185Recognized forms include: 186.Pp 187.Bl -tag -width lastSun -compact -offset indent 188.It \&5 189the fifth of the month 190.It lastSun 191the last Sunday in the month 192.It lastMon 193the last Monday in the month 194.It Sun>=8 195first Sunday on or after the eighth 196.It Sun<=25 197last Sunday on or before the 25th 198.El 199.Pp 200Names of days of the week may be abbreviated or spelled out in full. 201Note that there must be no spaces within the 202.Em ON 203field. 204.It AT 205Give the time of day at which the rule takes effect. 206Recognized forms include: 207.Pp 208.Bl -tag -width "\&1:28:14" -offset indent -compact 209.It 2 210time in hours 211.It 2:00 212time in hours and minutes 213.It 15:00 21424-hour format time (for times after noon) 215.It 1:28:14 216time in hours, minutes, and seconds 217.It - 218equivalent to 0 219.El 220.Pp 221where hour 0 is midnight at the start of the day, 222and hour 24 is midnight at the end of the day. 223Any of these forms may be followed by the letter 224.Sq Li w 225if the given time is local 226.Dq "wall clock" 227time, 228.Sq Li s 229if the given time is local 230.Dq standard 231time, or 232.Sq Li u 233(or 234.Sq Li g 235or 236.Sq Li z ) 237if the given time is universal time; 238in the absence of an indicator, 239wall clock time is assumed. 240.It SAVE 241Give the amount of time to be added to local standard time when the rule is in 242effect. 243This field has the same format as the 244.Em AT 245field 246(although, of course, the 247.Sq Li w 248and 249.Sq Li s 250suffixes are not used). 251.It LETTER/S 252Give the 253.Dq "variable part" 254(for example, the 255.Dq S 256or 257.Dq D 258in 259.Dq EST 260or 261.Dq EDT ) 262of time zone abbreviations to be used when this rule is in effect. 263If this field is 264.Em \- , 265the variable part is null. 266.El 267.Pp 268A zone line has the form: 269.Dl "Zone NAME GMTOFF RULES/SAVE FORMAT [UNTILYEAR [MONTH [DAY [TIME]]]]" 270For example: 271.Dl "Zone Australia/Adelaide 9:30 Aus CST 1971 Oct 31 2:00" 272The fields that make up a zone line are: 273.Bl -tag -width indent 274.It NAME 275The name of the time zone. 276This is the name used in creating the time conversion information file for the 277zone. 278.It GMTOFF 279The amount of time to add to UTC to get standard time in this zone. 280This field has the same format as the 281.Em AT 282and 283.Em SAVE 284fields of rule lines; 285begin the field with a minus sign if time must be subtracted from UTC. 286.It RULES/SAVE 287The name of the rule(s) that apply in the time zone or, 288alternately, an amount of time to add to local standard time. 289If this field is 290.Em \- 291then standard time always applies in the time zone. 292.It FORMAT 293The format for time zone abbreviations in this time zone. 294The pair of characters 295.Em %s 296is used to show where the 297.Dq "variable part" 298of the time zone abbreviation goes. 299Alternately, 300a slash (/) 301separates standard and daylight abbreviations. 302.It UNTILYEAR [MONTH [DAY [TIME]]] 303The time at which the UTC offset or the rule(s) change for a location. 304It is specified as a year, a month, a day, and a time of day. 305If this is specified, 306the time zone information is generated from the given UTC offset 307and rule change until the time specified. 308The month, day, and time of day have the same format as the IN, ON, and AT 309fields of a rule; trailing fields can be omitted, and default to the 310earliest possible value for the missing fields. 311.Pp 312The next line must be a 313.Dq continuation 314line; this has the same form as a zone line except that the 315string 316.Dq Zone 317and the name are omitted, as the continuation line will 318place information starting at the time specified as the 319.Dq until 320information in the previous line in the file used by the previous line. 321Continuation lines may contain 322.Dq until 323information, just as zone lines do, indicating that the next line is a further 324continuation. 325.El 326.Pp 327A link line has the form 328.Dl "Link LINK-FROM LINK-TO" 329For example: 330.Dl "Link Europe/Istanbul Asia/Istanbul" 331The 332.Em LINK-FROM 333field should appear as the 334.Em NAME 335field in some zone line; 336the 337.Em LINK-TO 338field is used as an alternate name for that zone. 339.Pp 340Except for continuation lines, 341lines may appear in any order in the input. 342.Pp 343Lines in the file that describes leap seconds have the following form: 344.Dl "Leap YEAR MONTH DAY HH:MM:SS CORR R/S" 345For example: 346.Dl "Leap 1974 Dec 31 23:59:60 + S" 347The 348.Em YEAR , 349.Em MONTH , 350.Em DAY , 351and 352.Em HH:MM:SS 353fields tell when the leap second happened. 354The 355.Em CORR 356field 357should be 358.Dq + 359if a second was added 360or 361.Dq - 362if a second was skipped. 363.\" There's no need to document the following, since it's impossible for more 364.\" than one leap second to be inserted or deleted at a time. 365.\" The C Standard is in error in suggesting the possibility. 366.\" See Terry J Quinn, The BIPM and the accurate measure of time, 367.\" Proc IEEE 79, 7 (July 1991), 894-905. 368.\" or 369.\" .q ++ 370.\" if two seconds were added 371.\" or 372.\" .q -- 373.\" if two seconds were skipped. 374The 375.Em R/S 376field 377should be (an abbreviation of) 378.Dq Stationary 379if the leap second time given by the other fields should be interpreted as UTC 380or 381(an abbreviation of) 382.Dq Rolling 383if the leap second time given by the other fields should be interpreted as 384local wall clock time. 385.Sh "EXTENDED EXAMPLE" 386Here is an extended example of 387.Nm 388input, intended to illustrate many of its features. 389.Bd -literal 390# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S 391Rule Swiss 1940 only - Nov 2 0:00 1:00 S 392Rule Swiss 1940 only - Dec 31 0:00 0 - 393Rule Swiss 1941 1942 - May Sun>=1 2:00 1:00 S 394Rule Swiss 1941 1942 - Oct Sun>=1 0:00 0 395 396Rule EU 1977 1980 - Apr Sun>=1 1:00u 1:00 S 397Rule EU 1977 only - Sep lastSun 1:00u 0 - 398Rule EU 1978 only - Oct 1 1:00u 0 - 399Rule EU 1979 1995 - Sep lastSun 1:00u 0 - 400Rule EU 1981 max - Mar lastSun 1:00u 1:00 S 401Rule EU 1996 max - Oct lastSun 1:00u 0 - 402 403# Zone NAME GMTOFF RULES FORMAT UNTIL 404Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12 405 0:29:44 - BMT 1894 Jun 406 1:00 Swiss CE%sT 1981 407 1:00 EU CE%sT 408 409Link Europe/Zurich Switzerland 410.Ed 411.Pp 412In this example, the zone is named Europe/Zurich but it has an alias 413as Switzerland. 414Zurich was 34 minutes and 8 seconds west of GMT until 4151848-09-12 at 00:00, when the offset changed to 29 minutes and 44 416seconds. 417After 1894-06-01 at 00:00 Swiss daylight saving rules (defined 418with lines beginning with 419.Dq Rule Swiss ) 420apply, and the GMT offset became one hour. 421From 1981 to the present, EU daylight saving rules have 422applied, and the UTC offset has remained at one hour. 423.Pp 424In 1940, daylight saving time applied from November 2 at 00:00 to 425December 31 at 00:00. 426In 1941 and 1942, daylight saving time applied 427from the first Sunday in May at 02:00 to the first Sunday in October 428at 00:00. 429The pre-1981 EU daylight-saving rules have no effect 430here, but are included for completeness. 431Since 1981, daylight 432saving has begun on the last Sunday in March at 01:00 UTC. 433Until 1995 it ended the last Sunday in September at 01:00 UTC, 434but this changed to the last Sunday in October starting in 1996. 435.Pp 436For purposes of 437display, 438.Dq LMT 439and 440.Dq BMT 441were initially used, respectively. 442Since 443Swiss rules and later EU rules were applied, the display name for the 444timezone has been CET for standard time and CEST for daylight saving 445time. 446.Sh NOTES 447For areas with more than two types of local time, 448you may need to use local standard time in the 449.Em AT 450field of the earliest transition time's rule to ensure that 451the earliest transition time recorded in the compiled file is correct. 452.Pp 453If, 454for a particular zone, 455a clock advance caused by the start of daylight saving 456coincides with and is equal to 457a clock retreat caused by a change in UTC offset, 458.Nm 459produces a single transition to daylight saving at the new UTC offset 460(without any change in wall clock time). 461To get separate transitions 462use multiple zone continuation lines 463specifying transition instants using universal time. 464.Sh FILES 465.Bl -tag -width ".Pa /usr/share/zoneinfo" -compact 466.It Pa /usr/share/zoneinfo 467standard directory used for created files 468.El 469.Sh "SEE ALSO" 470.Xr ctime 3 , 471.Xr tzfile 5 , 472.Xr zdump 8 473.\" @(#)zic.8 8.6 474