zic帮助文档

http://chinese-linux-man-pages.coding-school.com/man/X_zic-8



描述
Zic 从文件中读取文本输入,文件的名字是用命令行指定的;然后生成时间转换信息文件,此文件由输入指定。如果 文件名 是 - ,从标准输入中读取。
可得到以下选项:
-d 目录
在指定的目录中生成时间转换信息文件,而不是下面的标准的目录名。
-l 时区
用给定的时区作为本地时间。 Zic 对此选项的对待如同在输入中有下面格式的连接行

      连接 (从) 时区 (到)本地时间
-p 时区
当处理 POSIX 格式的时区环境变量时,使用给定的时区规则。 Zic 对此选项的对待如同在输入中有下面格式的连接行

      连接 (从) 时区 (到)POSIX规则
-L 闰秒文件名
从指定名字的文件中读闰秒信息。如果不使用本选项,则在输出文件中不出现闰秒信息。
译注: 早期的日期时间度量采用天文方法,GMT (Greenwich Mean
Time,格林威治平均时) 中的 Greenwich 所指称的是英国的一个天文台。1948年发明了原子钟,当前使用铯133原子钟的国际原子时间(TAI)与地球的公转和自转无关。由于地球自转的速度逐渐变慢,为保持与太阳运动的同相, 当 TAI 与太阳时之间的差距达到 800ms 时,在太阳时中加入闰秒调快太阳时的时间系统。矫正后的时间称为 UTC 时间(Universal Coordinated Time,世界时)。 PC 机以本机器内的晶振计时, 没有与 UTC 时间同步的机制。UTC 是法语的缩写。引自:现代操作系统/Andrew S. Tanebaum 著。-北京: 机械工业出版社,1999.11。第 11 章,第 11.1.2 节;第 5 章,第 5.4.1 节。
-v
当出现在数据文件中的年超出了 time(2) 可表示的值的年的范围时提出申诉。 (让用户知道他干不了超出自身能力的事)
-s
限定在输出文件中存储的时间值无论被作为有符号或无符号均是同一个值。你能用此选项生成 SVVS 兼容文件。
译注: 传统 UNIX 使用三十二位有符号整数计数器以秒为单位计
时,以1970年1月1日为零起点,在2038年将溢出,负数可表示到 1901年。Linux 使用三十二位无符号整数计数器以秒为单位计时,以1970年1月1日为零起点,在2106年将溢出。由此决定了时间值的范围(至少是在 ANSI C 中)。引自:现代操作系统/Andrew S. Tanebaum 著。-北京: 机械工业出版社,1999.11。第 5 章,第 5.4.2 节。
-y 命令
当检测年的类型时,使用给定的 命令 ,而不是 yearistype (见后)
输入行由字段组成。字段之间以白空格字符(空格或 TAB)分隔。前导和后挂的白空格将被忽略。在输入中的未加引号的 # 号表示直到其所在行结束的部分是注释。如果要在字段中使用空白和 # 号,你要把它们用双引号括起来。任何(去除了注释后的)空行将被忽略。非空行应是以下三种类型之一: 规则行,时区行,连接行。
规则行的格式


    

Rule  NAME  FROM  TO    TYPE  IN   ON       AT    SAVE  LETTER/S

例如:


    
Rule  US    1967  1973  -     Apr  lastSun  2:00  1:00  D

组成规则行的字段是:
NAME 名字
给出此条规则所属的规则集的名字,名字可任意起。 FROM 从...(年) 给出本规则应用的启始年份。提供的年份可以是任何整数; minimum 最小 (或其略写)一词的意思是可表示成整数的最小年份。 maximum 最大 (或其略写)一词的意思是可表示成整数的最大年份。规则可以描述不能以时间值表示的时间,但忽略不能以时间值表示的时间,这允许规则在不同时间值类型的主机之间有可移植性。
TO 到...(年)
给出本规则应用的终止年份。除了上面的 最大 和 最小 , only 唯一 (或其略写)一词的意思是与 FROM 字段有相同的值。
TYPE 类型
给出本规则应用的年份类型。如果 TYPE 是 - ,则本规则应用于包含在 FROM 和 TO 之间的所有年份。如果是其他类型,则 Zic 执行下面的命令
      yearistype year type
来检测某一年的类型: 退出状态 0 表示此年是给定的类型;退出状态非 0 表示此年不是给定的类型。
IN 在...(月)
给出本规则有效的月份的名字。月份的名字可用缩写。
ON 在...(日)
给出本规则有效的日期。可识别的日期的格式包括:
5        一个月的第 5 天
lastSun  一个月的最后的星期天
lastMon  一个月的最后的星期一
Sun>=8   一个月的第 8 天以后(含第 8 天)的第一个星期天
Sun<=25  一个月的第 25 天以前(含第 25 天)的最后一个星期天
星期的名字是可以缩写或全拼。注意在 ON 字段中不能有空格。
AT 在...(时间)
给出本规则有效的时间。可识别的时间的格式包括:


2        用小时表示的时间
2:00     用小时:分钟表示的时间
15:00    用 24 制小时表示的时间 (表示下午的时间)
1:28:14  用小时:分钟:秒钟表示的时间
这里午夜 0 点是一天开始, 午夜 24 点是一天结束。对于任何以上格式,如果给定的时间是本地的 时间,可以后跟字母 w ; 如果给定的时间是本地的 时间,可以后跟字母 s ; 果给定的时间世界时间,可以后跟字母 u (或 g 或 z ) 如果没写此种指示符,假定是"墙钟"时间。
译注:例如我的"墙钟"时间是北京时间(GMT+8),我的本地标准时间
是 GMT+9(哈尔滨所在的时区的时间)。
SAVE 补偿
给出当本规则有效时增加到本地标准时间上的时间量。本字段与 AT 字段格式相同(当然,未使用 w 和 s 后缀)。
LETTER/S 字母
给出当本规则有效时时区缩写的 (例如, 的 -,可变部分是空。
时区行格式


    
Zone  NAME                GMTOFF  RULES/SAVE  FORMAT  [UNTIL]

例如:



     Zone                 Australia/Adelaide  9:30    AusCST1971 Oct 31 2:00

组成规则行的字段是:
NAME 名字
时区的名称,被作为为时区而生成的时间转换文件的名字。
GMTOFF GMT-偏移量
为得到本时区的标准时间而应加到 UTC 时间上的时间量。本字段与规则行的 AT 和 SAVE 有相同的格式;字段值是负值 (即以负号开始)表示要从 UTC 时间上减去的时间量。
RULES/SAVE 规则/补偿
本时区应用的规则的名字,或者是应加到本地标准时间上的时间量 。如果本字段是 - ,则本时区总是用标准时间。
FORMAT 格式
本时区的时区缩写的格式。字符对 %s 表示时区缩写的 。另外,/ 符号(斜扛) 分隔标准时和夏令时的缩写。
UNTIL 直到
是某个位置的 UTC 偏移量或规则改变的时间。它被指定为 某年某月某日某时。如果指定了本字段,直到指定的时间之后,才会产生从改变了的 UTC 偏移量和规则生成的时区信息。某年某月某日某时的格式同于规则中的 IN、ON 和 AT 列;随后的列可以省略,给未写出的列的缺省值是可能的最早的值。
下一行必须是一个 的行,就是说,除了字符串 和名字省略了之外,与时区行有一样的格式;接续行在上一行的 UNTIL 字段所指定的时间开始后,按本行的 UTC 偏移量或规则在上一行名字字段指定的文件中生成时区信息。接续行可以有象时区行一样的 UNTIL 字段,用于指示下一行是自己的接续。
译注:上面的这段绕口令的意思是
zome 输出的时区文件名 规则1 规则2生效时间规则2 规则3生效时间 规则n
连接行格式


    
Link  LINK-FROM        LINK-TO

例如:



     Link              Europe/IstanbulAsia/Istanbul

LINK-FROM 字段的值应是在某个时区行的 NAME 名字 字段上出现过; LINK-TO 字段是那个时区的可替代的名字。
除了接续行之外,行可在文件中以任意顺序出现。
描述闰秒的文件中的行有以下格式:


    

Leap  YEAR  MONTH  DAY  HH:MM:SS  CORR  R/S

例如:


    
Leap  1974  Dec    31   23:59:60  +     S

字段 YEAR、 MONTH、 DAY 和 HH:MM:SS 说明什么时侯闰秒出现。 CORR 字段在应增加一秒时是 在其他字段给出的闰秒时间应被解释为 UTC 时间的情况下, R/S 字段应是 S ( 静止一词的缩写);在其他字段给出的闰秒时间应被解释为本地墙钟时间的情况下, R/S 字段应是 R(  
注意
对于有多于两种类型的本地时间的地区,你可能需要用最早变更时间的规则的 AT 字段中的本地标准时间,来确保记录在编译的文件中的最早变更时间是正确的。  
相关文件
/usr/local/etc/zoneinfo 生成的文件所在的标准目录。  
又见

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





zic
zic [options] [files]
System administration command. Create time conversion information files from the file or files specified. If the specified file is -, read information from standard input.
Options
-d directory
Place the newly created files in directory. Default is /usr/local/etc/zoneinfo.
-l timezone
Specify a timezone to use for local time. zic links the zone information for timezone with the zone localtime.
-p timezone
Set the default rules for handling POSIX-format environment variables to the zone name specified by timezone.
-s
Store time values only if they are the same when signed as when unsigned.
-v
Verbose mode. Include extra error checking and warnings.
-y command
Check year types with command. Default is yearistype.
-L file
Consult file for information about leap seconds.
The source files for zic should be formatted as a sequence of rule lines, zone lines, and link lines. An optional file containing leap-second rules can be specified on the command line. Rule lines describe how time should be calculated. They describe changes in time, daylight savings time, and any other changes that might affect a particular time zone. Zone lines specify which rules apply to a given zone. Link lines link similar zones together. Leap lines describe the exact time when leap seconds should be added or subtracted. Each of these lines is made up of fields. Fields are separated from one another by any number of whitespace characters. Comment lines are preceded by #. The fields used in each line are listed in the next section.
Rule line fields
The format of a rule line is:
Rule NAME FROM TO TYPE IN ON AT SAVE LETTERS
NAME
Name this set of rules.
FROM
Specify the first year to which this rule applies. Gregorian calendar dates are assumed. Instead of specifying an actual year, you may specify minimum or maximum for the minimum or maximum year, representable as an integer.
TO
Specify the last year to which this rule applies. Syntax is the same as for the FROM field.
TYPE
Specify the type of year to which this rule should be applied. The wildcard - instructs that all years be included. Any given year's type will be checked with the command given with the -y option or the default yearistype year type. An exit status of 0 is taken to mean the year is of the given type; an exit status of 1 means that it is not of the given type (see -y option).
IN
Specify month in which this rule should be applied.
ON
Specify day on which this rule should be applied. Whitespace is not allowed. For example:
1
The 1st.
firstSun
The first Sunday.
Sun>=3
The first Sunday to occur before or on the 3rd.
AT
Specify the time after which the rule is in effect. For example, you may use 13, 13:00, or 13:00:00 for 1:00 p.m. You may include one of several suffixes (without whitespace between):
s
Local standard time.
u, g, z
Universal time.
w
Wall clock time (default).
SAVE
Add this amount of time to the local standard time. Formatted like AT, without suffixes.
LETTERS
Specify letter or letters to be used in time zone abbreviations (for example, S for EST). For no abbreviation, enter -.
Zone line fields
The format of a zone line is:
Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
NAME
Time zone name.
GMTOFF
The amount of hours by which this time zone differs from GMT. Formatted like AT. Negative times are subtracted from GMT; by default, times are added to it.
RULES/SAVE
Either the name of the rule to apply to this zone or the amount of time to add to local standard time. To make the zone the same as local standard time, specify -.
FORMAT
The format of time zone abbreviations. Specify the variable part with %s.
UNTIL
Change the rule for the zone at this date. The next line must specify the new zone information and therefore must omit the string "Zone" and the NAME field.
Link line fields
The format of a link line is:
Link LINK-FROM LINK-TO
LINK-FROM
The name of the zone that is being linked.
LINK-TO
An alternate name for the zone that was specified as LINK-FROM.
Leap line fields
The format of a leap line is:
Leap YEAR MONTH DAY HH:MM:SS CORR R|S
YEAR MONTH DAY HH:MM:SS
Specify when the leap second happened.
CORR
Uses + or - to show whether the second was added or skipped.
R|S
Rolling or Stationary. Describe whether the leap second should be applied to local wall-clock time or GMT, respectively.
s

猜你喜欢

转载自junge8618.iteye.com/blog/884925