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