zic 中文man頁面
NAME
zic - 時區(qū)編輯器
總覽
zic [ -v ] [ -d directory ] [ -l localtime ] [ -p posixrules ] [ -L leapsecondfilename ] [ -s ] [ -y command ] [ filename ... ]
描述
Zic 從文件中讀取文本輸入,文件的名字是用命令行指定的;然后生成時間轉(zhuǎn)換信息文件,此文件由輸入指定。如果 文件名 是 - ,從標(biāo)準(zhǔn)輸入中讀取。
可得到以下選項:
- -d 目錄
- 在指定的目錄中生成時間轉(zhuǎn)換信息文件,而不是下面的標(biāo)準(zhǔn)的目錄名。
- -l 時區(qū)
- 用給定的時區(qū)作為本地時間。 Zic 對此選項的對待如同在輸入中有下面格式的連接行
連接 (從) 時區(qū) (到)本地時間 - -p 時區(qū)
- 當(dāng)處理 POSIX 格式的時區(qū)環(huán)境變量時,使用給定的時區(qū)規(guī)則。 Zic 對此選項的對待如同在輸入中有下面格式的連接行
連接 (從) 時區(qū) (到)POSIX規(guī)則 - -L 閏秒文件名
- 從指定名字的文件中讀閏秒信息。如果不使用本選項,則在輸出文件中不出現(xiàn)閏秒信息。
- 譯注: 早期的日期時間度量采用天文方法,GMT (Greenwich Mean
- Time,格林威治平均時) 中的 Greenwich 所指稱的是英國的一個天文臺。1948年發(fā)明了原子鐘,當(dāng)前使用銫133原子鐘的國際原子時間(TAI)與地球的公轉(zhuǎn)和自轉(zhuǎn)無關(guān)。由于地球自轉(zhuǎn)的速度逐漸變慢,為保持與太陽運動的同相, 當(dāng) TAI 與太陽時之間的差距達(dá)到 800ms 時,在太陽時中加入閏秒調(diào)快太陽時的時間系統(tǒng)。矯正后的時間稱為 UTC 時間(Universal Coordinated Time,世界時)。 PC 機(jī)以本機(jī)器內(nèi)的晶振計時, 沒有與 UTC 時間同步的機(jī)制。UTC 是法語的縮寫。引自:現(xiàn)代操作系統(tǒng)/Andrew S. Tanebaum 著。-北京: 機(jī)械工業(yè)出版社,1999.11。第 11 章,第 11.1.2 節(jié);第 5 章,第 5.4.1 節(jié)。
- -v
- 當(dāng)出現(xiàn)在數(shù)據(jù)文件中的年超出了 time(2) 可表示的值的年的范圍時提出申訴。 (讓用戶知道他干不了超出自身能力的事)
- -s
- 限定在輸出文件中存儲的時間值無論被作為有符號或無符號均是同一個值。你能用此選項生成 SVVS 兼容文件。
- 譯注: 傳統(tǒng) UNIX 使用三十二位有符號整數(shù)計數(shù)器以秒為單位計
- 時,以1970年1月1日為零起點,在2038年將溢出,負(fù)數(shù)可表示到 1901年。Linux 使用三十二位無符號整數(shù)計數(shù)器以秒為單位計時,以1970年1月1日為零起點,在2106年將溢出。由此決定了時間值的范圍(至少是在 ANSI C 中)。引自:現(xiàn)代操作系統(tǒng)/Andrew S. Tanebaum 著。-北京: 機(jī)械工業(yè)出版社,1999.11。第 5 章,第 5.4.2 節(jié)。
- -y 命令
- 當(dāng)檢測年的類型時,使用給定的 命令 ,而不是 yearistype (見后)
輸入行由字段組成。字段之間以白空格字符(空格或 TAB)分隔。前導(dǎo)和后掛的白空格將被忽略。在輸入中的未加引號的 # 號表示直到其所在行結(jié)束的部分是注釋。如果要在字段中使用空白和 # 號,你要把它們用雙引號括起來。任何(去除了注釋后的)空行將被忽略。非空行應(yīng)是以下三種類型之一: 規(guī)則行,時區(qū)行,連接行。
規(guī)則行的格式
Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S 例如:
Rule US 1967 1973 - Apr lastSun 2:00 1:00 D
組成規(guī)則行的字段是:
- NAME 名字
- 給出此條規(guī)則所屬的規(guī)則集的名字,名字可任意起。 FROM 從...(年) 給出本規(guī)則應(yīng)用的啟始年份。提供的年份可以是任何整數(shù); minimum 最小 (或其略寫)一詞的意思是可表示成整數(shù)的最小年份。 maximum 最大 (或其略寫)一詞的意思是可表示成整數(shù)的最大年份。規(guī)則可以描述不能以時間值表示的時間,但忽略不能以時間值表示的時間,這允許規(guī)則在不同時間值類型的主機(jī)之間有可移植性。
- TO 到...(年)
- 給出本規(guī)則應(yīng)用的終止年份。除了上面的 最大 和 最小 , only 唯一 (或其略寫)一詞的意思是與 FROM 字段有相同的值。
- TYPE 類型
- 給出本規(guī)則應(yīng)用的年份類型。如果 TYPE 是 - ,則本規(guī)則應(yīng)用于包含在 FROM 和 TO 之間的所有年份。如果是其他類型,則 Zic 執(zhí)行下面的命令
yearistype year type
來檢測某一年的類型: 退出狀態(tài) 0 表示此年是給定的類型;退出狀態(tài)非 0 表示此年不是給定的類型。 - IN 在...(月)
- 給出本規(guī)則有效的月份的名字。月份的名字可用縮寫。
- ON 在...(日)
- 給出本規(guī)則有效的日期。可識別的日期的格式包括:
5 一個月的第 5 天
lastSun 一個月的最后的星期天
lastMon 一個月的最后的星期一
Sun>=8 一個月的第 8 天以后(含第 8 天)的第一個星期天
Sun<=25 一個月的第 25 天以前(含第 25 天)的最后一個星期天
星期的名字是可以縮寫或全拼。注意在 ON 字段中不能有空格。
- AT 在...(時間)
- 給出本規(guī)則有效的時間??勺R別的時間的格式包括:
2 用小時表示的時間 2:00 用小時:分鐘表示的時間 15:00 用 24 制小時表示的時間 (表示下午的時間) 1:28:14 用小時:分鐘:秒鐘表示的時間
這里午夜 0 點是一天開始, 午夜 24 點是一天結(jié)束。對于任何以上格式,如果給定的時間是本地的 時間,可以后跟字母 w ; 如果給定的時間是本地的 時間,可以后跟字母 s ; 果給定的時間世界時間,可以后跟字母 u (或 g 或 z ) 如果沒寫此種指示符,假定是"墻鐘"時間。
- 譯注:例如我的"墻鐘"時間是北京時間(GMT+8),我的本地標(biāo)準(zhǔn)時間
- 是 GMT+9(哈爾濱所在的時區(qū)的時間)。
- SAVE 補(bǔ)償
- 給出當(dāng)本規(guī)則有效時增加到本地標(biāo)準(zhǔn)時間上的時間量。本字段與 AT 字段格式相同(當(dāng)然,未使用 w 和 s 后綴)。
- LETTER/S 字母
- 給出當(dāng)本規(guī)則有效時時區(qū)縮寫的 (例如, 的 -,可變部分是空。
時區(qū)行格式
Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL] 例如:
Zone Australia/Adelaide 9:30 AusCST1971 Oct 31 2:00
組成規(guī)則行的字段是:
- NAME 名字
- 時區(qū)的名稱,被作為為時區(qū)而生成的時間轉(zhuǎn)換文件的名字。
- GMTOFF GMT-偏移量
- 為得到本時區(qū)的標(biāo)準(zhǔn)時間而應(yīng)加到 UTC 時間上的時間量。本字段與規(guī)則行的 AT 和 SAVE 有相同的格式;字段值是負(fù)值 (即以負(fù)號開始)表示要從 UTC 時間上減去的時間量。
- RULES/SAVE 規(guī)則/補(bǔ)償
- 本時區(qū)應(yīng)用的規(guī)則的名字,或者是應(yīng)加到本地標(biāo)準(zhǔn)時間上的時間量 。如果本字段是 - ,則本時區(qū)總是用標(biāo)準(zhǔn)時間。
- FORMAT 格式
- 本時區(qū)的時區(qū)縮寫的格式。字符對 %s 表示時區(qū)縮寫的 。另外,/ 符號(斜扛) 分隔標(biāo)準(zhǔn)時和夏令時的縮寫。
- UNTIL 直到
- 是某個位置的 UTC 偏移量或規(guī)則改變的時間。它被指定為 某年某月某日某時。如果指定了本字段,直到指定的時間之后,才會產(chǎn)生從改變了的 UTC 偏移量和規(guī)則生成的時區(qū)信息。某年某月某日某時的格式同于規(guī)則中的 IN、ON 和 AT 列;隨后的列可以省略,給未寫出的列的缺省值是可能的最早的值。
- 下一行必須是一個 的行,就是說,除了字符串 和名字省略了之外,與時區(qū)行有一樣的格式;接續(xù)行在上一行的 UNTIL 字段所指定的時間開始后,按本行的 UTC 偏移量或規(guī)則在上一行名字字段指定的文件中生成時區(qū)信息。接續(xù)行可以有象時區(qū)行一樣的 UNTIL 字段,用于指示下一行是自己的接續(xù)。
- 譯注:上面的這段繞口令的意思是
- zome 輸出的時區(qū)文件名 規(guī)則1 規(guī)則2生效時間規(guī)則2 規(guī)則3生效時間 規(guī)則n
連接行格式
Link LINK-FROM LINK-TO 例如:
Link Europe/IstanbulAsia/Istanbul
LINK-FROM 字段的值應(yīng)是在某個時區(qū)行的 NAME 名字 字段上出現(xiàn)過; LINK-TO 字段是那個時區(qū)的可替代的名字。
除了接續(xù)行之外,行可在文件中以任意順序出現(xiàn)。
描述閏秒的文件中的行有以下格式:
Leap YEAR MONTH DAY HH:MM:SS CORR R/S 例如:
Leap 1974 Dec 31 23:59:60 + S
字段 YEAR、 MONTH、 DAY 和 HH:MM:SS 說明什么時侯閏秒出現(xiàn)。 CORR 字段在應(yīng)增加一秒時是 在其他字段給出的閏秒時間應(yīng)被解釋為 UTC 時間的情況下, R/S 字段應(yīng)是 S ( 靜止一詞的縮寫);在其他字段給出的閏秒時間應(yīng)被解釋為本地墻鐘時間的情況下, R/S 字段應(yīng)是 R(
注意
對于有多于兩種類型的本地時間的地區(qū),你可能需要用最早變更時間的規(guī)則的 AT 字段中的本地標(biāo)準(zhǔn)時間,來確保記錄在編譯的文件中的最早變更時間是正確的。
相關(guān)文件
/usr/local/etc/zoneinfo 生成的文件所在的標(biāo)準(zhǔn)目錄。 newctime(3), tzfile(5), zdump(8)
#p#
NAME
zic - time zone compiler
SYNOPSIS
zic [ -v ] [ -d directory ] [ -l localtime ] [ -p posixrules ] [ -L leapsecondfilename ] [ -s ] [ -y command ] [ filename ... ]
DESCRIPTION
Zic reads text from the file(s) named on the command line and creates the time conversion information files specified in this input. If a filename is -, the standard input is read.
These options are available:
- -d directory
- Create time conversion information files in the named directory rather than in the standard directory named below.
- -l timezone
- Use the given time zone as local time. Zic will act as if the input contained 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. Zic will act as if the input contained 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
- Complain if a year that appears in a data file is outside the range of years representable by time(2) values.
- -s
- Limit time values stored in output files to values that are the same whether they're taken to be 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 (see below).
Input lines are made up of fields. Fields are separated from one another by any number of white space characters. Leading and trailing white space on input lines is ignored. An unquoted sharp character (#) in the input introduces a comment which extends to the end of the line the sharp character appears on. White space characters and sharp characters may be enclosed in double quotes (") if they're to be 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:
- NAME
- Gives the (arbitrary) name of the set of rules this rule is part of.
- 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 representable as an integer. The word maximum (or an abbreviation) means the maximum year representable as an integer. Rules can describe times that are not representable 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 minimum and maximum (as above), the word only (or an abbreviation) may be used to repeat the value of the FROM field.
- TYPE
- Gives the type of year in which the rule applies. If TYPE is - then the rule applies in all years between FROM and TO inclusive. If TYPE is something else, then zic executes the command
yearistype year type
to check the type of a year: an exit status of zero is taken to mean that the year is of the given type; an exit status of one is taken to mean that the year is not of the given type. - IN
- Names the month in which the rule takes effect. Month names may be abbreviated.
- 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
Names of days of the week may be abbreviated or spelled out in full. Note that 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 - equivalent to 0
where hour 0 is midnight at the start of the day, and hour 24 is midnight at the end of the day. Any of these forms may be followed by the letter w if the given time is local time, s if the given time is local time, or 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, of course, the w and s suffixes are not used).
- LETTER/S
- Gives the (for example, the or in or of time zone abbreviations to be used when this rule is in effect. If this field is -, 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 AusCST1971 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 UTC 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 UTC.
- 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 - then standard time always applies in the time zone.
- FORMAT
- The format for time zone abbreviations in this time zone. The pair of characters %s is used to show where the of the time zone abbreviation goes. Alternately, a slash (/) separates standard and daylight abbreviations.
- UNTIL
- The time at which the UTC 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 UTC 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 line; this has the same form as a zone line except that the string and the name are omitted, as the continuation line will place information starting at the time specified as the UNTIL field in the previous line in the file used by the previous line. Continuation lines may contain an UNTIL field, just as zone lines do, indicating that the next line is a further continuation.
A link line has the form
Link LINK-FROM LINK-TO For example:
Link Europe/IstanbulAsia/Istanbul
The LINK-FROM field should appear 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 may appear in any order in the input.
Lines in the file that describes 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 should be if a second was added or if a second was skipped. The R/S field should be (an abbreviation of) if the leap second time given by the other fields should be interpreted as UTC or (an abbreviation of) 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 may 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.
FILE
/usr/local/etc/zoneinfo standard directory used for created files
SEE ALSO
newctime(3), tzfile(5), zdump(8)