Index Index for
Section 8
Index Alphabetical
listing for Z
Bottom of page Bottom of
page

zic(8)

NAME

zic - Time zone compiler

SYNOPSIS

/usr/bin/zic [-v] [-d directory] [-l localtime] [-p posixrules] [-L leapsecondfilename] [-s] [-y commandname] [filename...]

OPTIONS

-d directory Create time conversion information files in the named directory rather than in the standard directory. -l timezone Use the given time zone as local time. The zic compiler acts as if the input contains a link line of the form: link timezone localtime -p timezone Use the given time zone's rules when handling POSIX-format time zone environment variables. The zic compiler acts as if the input contains a link line of the form: Link timezone posixrules -L leapsecondfilename Read leap second information from the file with the given name. If this option is not used, no leap second information appears in output files. -v Returns a warning if a year that appears in a data file is outside the range of years representable by time(3) values. -s Limit time values stored in output files to values that are the same whether they are signed or unsigned. You can use this option to generate SVVS-compatible files. -y command Use the given command rather than yearistype when checking year types.

DESCRIPTION

The zic compiler reads text from the file(s) named on the command line and creates the time conversion information files specified. If the filename parameter is specified as a dash (-), the standard input is read. Timezone information files are stored in the /etc/zoneinfo directory. Input lines are made up of fields that are separated from one another by any number of white space characters. Leading and trailing white space is ignored. An unquoted number sign (#) character in the input introduces a comment which extends to the end of the line on which the number sign # character appears. Enclose white space characters and number sign # characters in double quotation marks (" ") if the characters are used as part of a field. Any line that is blank (after comment stripping) is ignored. Non-blank lines are expected to be of one of three types: rule lines, zone lines, and link lines. A rule line has the form: Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S For example: Rule US 1967 1973 - Apr lastSun 2:00 1:00 D The fields that make up a rule line are as follows: NAME Gives the (arbitrary) name of the set of rules of which this rule is part. FROM Gives the first year in which the rule applies. Any integer year can be supplied; the Gregorian calendar is assumed. The word "minimum" (or an abbreviation) means the minimum year with a representable time value. The word "maximum" (or an abbreviation) means the maximum year with a representable time value. Rules can describe times that cannot be represented as time values, with the unrepresentable times ignored. This allows rules to be portable among hosts with differing time value types. TO Gives the final year in which the rule applies. In addition to the words "minimum" and "maximum", you can use the word "only" to repeat the value of the FROM field. TYPE Gives the type of year in which the rule applies. If TYPE is a dash (-) then the rule applies in all years between FROM and TO inclusive. If TYPE is something else, then the zic complier executes the following command to check the type of a year: yearistype year type An exit status of zero indicates that the year is of the given type; an exit status of one indicates that the year is not of the given type. IN Names the month in which the rule takes effect. You can abbreviate month names. ON Gives the day on which the rule takes effect. Recognized forms include: 5 the fifth of the month lastSun the last Sunday in the month lastMon the last Monday in the month Sun>=8 first Sunday on or after the eighth Sun<=25 last Sunday on or before the 25th You can abbreviate names of days of the week or spelled them out in full. There must be no spaces within the ON field. AT Gives the time of day at which the rule takes effect. Recognized forms include: 2 time in hours 2:00 time in hours and minutes 15:00 24-hour format time (for times after noon) 1:28:14 time in hours, minutes, and seconds You can follow any of these forms with the letter w if the given time is local wall clock time, the letter s if the given time is local standard time, or the letter u (or g or z) if the given time is universal time. In the absence of an indicator, wall clock time is assumed. SAVE Gives the amount of time to be added to local standard time when the rule is in effect. This field has the same format as the AT field (although, the w and s suffixes are not used). LETTER/S Gives the variable part (for example, the S or D in EST or EDT) of time zone abbreviations to be used when this rule is in effect. If this field is a dash (-), the variable part is null. A zone line has the form: Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] For example: Zone Australia/Adelaide 9:30 Aus CST 1971 Oct 31 2:00 The fields that make up a zone line are: NAME The name of the time zone. This is the name used in creating the time conversion information file for the zone. GMTOFF The amount of time to add to GMT to get standard time in this zone. This field has the same format as the AT and SAVE fields of rule lines; begin the field with a minus sign if time must be subtracted from GMT. RULES/SAVE The name of the rule(s) that apply in the time zone or, alternately, an amount of time to add to local standard time. If this field is a dash (-), then standard time always applies in the time zone. FORMAT The format for time zone abbreviations in this time zone. Use a percent sign followed by the letter s (%s) to indicate where the variable part of the time zone abbreviation goes. Alternately, a slash (/) separates standard and daylight abbreviations. UNTIL The time at which the GMT offset or the rule(s) change for a location. It is specified as a year, a month, a day, and a time of day. If this is specified, the time zone information is generated from the given GMT offset and rule change until the time specified. The month, day, and time of day have the same format as the IN, ON, and AT columns of a rule; trailing columns can be omitted, and default to the earliest possible value for the missing columns. The next line must be a continuation line, which has the same form as a zone line except that the string Zone and the name are omitted. Continuation lines can also contain an UNTIL field indicating that the next line is a further continuation. The following example shows two continutaion lines following a zone line: # Zone NAME GMTOFF RULES FORMAT [UNTIL] # Northern Territory Zone Australia/Darwin 8:43:20 - LMT 1895 Feb 9:00 - CST 1899 May 9:30 Aus CST A link line has the form: Link LINK-FROM LINK-TO For example: Link Europe/Istanbul Asia/Istanbul The LINK-FROM field appears as the NAME field in some zone line; the LINK- TO field is used as an alternate name for that zone. Except for continuation lines, lines can appear in any order. Lines in the file that describe leap seconds have the following form: Leap YEAR MONTH DAY HH:MM:SS CORR R/S For example: Leap 1974 Dec 31 23:59:60 + S The YEAR, MONTH, DAY, and HH:MM:SS fields tell when the leap second happened. The CORR field is a plus sign (+) if a second was added or a minus sign (-) if a second was skipped. The R/S field is an abbreviation of Stationary if the leap second time given by the other fields should be interpreted as GMT or (an abbreviation of) Rolling if the leap second time given by the other fields should be interpreted as local wall clock time. Note For areas with more than two types of local time, you might need to use local standard time in the AT field of the earliest transition time's rule to ensure that the earliest transition time recorded in the compiled file is correct.

EXAMPLES

The following examples show how you use the time zone commands and databases. You must be logged in as superuser (root) to use the following commands: 1. Use a procedure similar to the following if a system is relocated to a new timezone. This example uses Australian time zones and shows what you need to do when relocating a host system from from Brisbane (Queensland) to Sydney (New South Wales): a. Verify the value of the link file /etc/zoneinfo/localtime as follows: # ls -l /etc/zoneinfo/localtime lrwxrwxrwx 1 root system 18 Mar 19 17:05 localtime -> \ ./Australia/Queensland b. If necessary, use the zdump command to verify transitions in the target time zone as follows: #zdump -c 2001 -v Australia/NSW Australia/NSW Fri Dec 13 20:45:52 1901 GMT = Fri Dec 13 15:45:52 1901 EST \ isdst=0 gmtoff=-18000 Australia/NSW Sat Dec 14 20:45:52 1901 GMT = Sat Dec 14 15:45:52 1901 EST \ isdst=0 gmtoff=-18000 Australia/NSW Sun Mar 31 06:59:59 1918 GMT = Sun Mar 31 01:59:59 1918 EST \ isdst=0 gmtoff=-18000 Australia/NSW Sun Mar 31 07:00:00 1918 GMT = Sun Mar 31 03:00:00 1918 EWT \ isdst=1 gmtoff=-14400 Australia/NSW Sun Oct 27 05:59:59 1918 GMT = Sun Oct 27 01:59:59 1918 EWT \ isdst=1 gmtoff=-14400 . . . (output truncated) c. Delete the /etc/zoneinfo/localtime link as follows: # rm /etc/zoneinfo/localtime d. Create a new /etc/zoneinfo/localtime link, specifying the target time zone as follows: # ln -s /etc/zoneinfo/Australia/NSW localtime #ls -l localtime should now be: localtime -> ./Australia/NSW check the transitions have changed using zdump Verify the new link as follows: # ls -l /etc/zoneinfo/localtime lrwxrwxrwx 1 root system 18 Mar 19 17:05 /etc/zoneinfo/localtime -> \ ./Australia/NSW e. Repeat the zdump command in Step b to verify transitions in the target time zone. 2. The system time automatically changes for events such as Daylight Savings Time. These time transitions are stored in the /etc/zoneinfo database. If necessary, you can verify and alter the rules that specify when a system will automatically alter its time. This example shows how you change the active /etc/zoneinfo file to include the changes to Daylight Savings Time. (Such a change was mandated for the 2000 Olympics, moving the start date of Daylight Savings Time to August 27th in 2000, rather than the expected date of October 29th.) The example assumes that the system is located in Sydney, Australia: a. Examine the active time zone setting as follows: # ls -l /etc/zoneinfo/localtime lrwxrwxrwx root system 18 Mar 19 17:05 etc/zoneinfo/localtime -> \ ./Australia/NSW b. Use the zdump command to verify the time transitions for the active time zone. The zdump command prints transitions for every year since the beginning of rules for the active timezone. Use the more command or redirect (>) the output to a file so you can find the relevent transition. Use the -c option to specify the year at which the display output terminates. For example: # zdump -c 2002 -v Australia/NSW Australia/NSW Sat Oct 30 15:59:59 1999 GMT = Sun Oct 31 01:59:59 1999 EST \ isdst=0 gmtoff=36000 Australia/NSW Sat Oct 30 16:00:00 1999 GMT = Sun Oct 31 03:00:00 1999 EST \ isdst=1 gmtoff=39600 Australia/NSW Sat Mar 25 15:59:59 2000 GMT = Sun Mar 26 02:59:59 2000 EST \ isdst=1 gmtoff=39600 Australia/NSW Sat Mar 25 16:00:00 2000 GMT = Sun Mar 26 02:00:00 2000 EST \ isdst=0 gmtoff=36000 Australia/NSW Sat Oct 28 15:59:59 2000 GMT = Sun Oct 29 01:59:59 2000 EST \ isdst=0 gmtoff=36000 Australia/NSW Sat Oct 28 16:00:00 2000 GMT = Sun Oct 29 03:00:00 2000 EST \ isdst=1 gmtoff=39600 Each pair of lines for the same date and time shows a time transition. On Sun Oct 29 2000 immediately after 01:59:59 the time changes to 03:00:00. This transition changes the local time from Australian Eastern Standard Time (EST) to Daylight Savings Time (DST). The value of the isdst field changes as follows: · 0 - Not Daylight Savings Time · 1 - Daylight Savings Time The gmtoff field displays the offset from Greenwich Mean Time. c. Display the contents of the /etc/zoneinfo database file for your locale to find the rules for the local zone. In this case, it is New South Wales: # more /etc/zoneinfo/sources/australasia . . # New South Wales # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule AN 1971 1985 - Oct lastSun 2:00s 1:00 - Rule AN 1972 only - Feb 27 2:00s 0 - Rule AN 1973 1981 - Mar Sun>=1 2:00s 0 - Rule AN 1982 only - Apr Sun>=1 2:00s 0 - Rule AN 1983 1985 - Mar Sun>=1 2:00s 0 - Rule AN 1986 1989 - Mar Sun>=15 2:00s 0 - Rule AN 1986 only - Oct 19 2:00s 1:00 - Rule AN 1987 1999 - Oct lastSun 2:00s 1:00 - Rule AN 1990 1995 - Mar Sun>=1 2:00s 0 - Rule AN 1996 max - Mar lastSun 2:00s 0 - # Zone NAME GMTOFF RULES FORMAT [UNTIL] Zone Australia/Sydney 10:04:52 - LMT 1895 Feb 10:00 Aus EST 1971 10:00 AN EST Zone Australia/Broken_Hill 9:25:48 - LMT 1895 Feb 10:00 - EST 1896 Aug 23 9:00 - CST 1899 May 9:30 Aus CST 1971 9:30 AN CST 2000 9:30 AS CST <display truncated> From this display, you find the rules that apply to the current year. For the year 2000 the rules are as follows: Rule AN 1996 max - Mar lastSun 2:00s 0 - The other rules either end on a past year or apply only for the year specified, as shown in the TO column. The entry max in the TO column means that the rule applies from the year listed in the FROM column and for all future years. d. Assume that on the last Sunday of October in 2000, you must change the time at 2:00 a.m. to be one hour more than the standard time (EST). On the last Sunday of March, you must change the time at 3:00 a.m. to be the same as EST, turning the clock back one hour when the previous rule was active. (In this example, the 27th happened to be the last Sunday in August, making the transition change less complicated.) The new rule that you must add is as follows: Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule AN 2000 only - Aug lastSun 2:00 1:00 - e. To avoid corrupting the /etc/zoneinfo/sources/australasia data file, copy it to a backup revision as follows: # cp /etc/zoneinfo/sources/australasia \ /etc/zoneinfo/sources/australasia.orig Then edit the file /etc/zoneinfo/sources/australasia with a text editor to add the following line: Rule AN 2000 only - Aug lastSun 2:00 1:00 - f. You can now use the zic command to update the database with the new transition rule as follows: # /usr/sbin/zic /etc/zoneinfo/sources/australasia g. Use the zdump command to verify the new transitions as follows: # zdump -c 2002 -v Australia/NSW . . .Australia/NSW Sat Aug 26 15:59:59 2000 GMT = Sun Aug 27 01:59:59 2000 \ EST isdst=0 gmtoff=36000 This truncated output indicates that the transition to Daylight Savings Time moved from October 29 to August 27, as required.

FILES

/etc/zoneinfo Standard directory used for created files /usr/sbin/yearistype Default script used to determine type of year

SEE ALSO

Commands: zdump(8), settz(8) Functions: ctime(3) Files: tzfile(4)

Index Index for
Section 8
Index Alphabetical
listing for Z
Top of page Top of
page