找回密码
 注册
查看: 1891|回复: 0

R语言:timezones()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-2-16 19:19:13 | 显示全部楼层 |阅读模式
timezones(base)
timezones()所属R语言包:base

                                        Time Zones
                                         时区

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Information about time zones in R.  Sys.timezone returns the current time zone.
河Sys.timezone时区信息返回当前的时区。


用法----------Usage----------


Sys.timezone()



Details

详情----------Details----------

Time zones are a system-specific topic, but these days almost all R platforms use the same underlying code, used by Linux, Mac OS X, Solaris, AIX, FreeBSD, Sun Java >= 1.4 and Tcl >= 8.5, and installed with R on Windows.
时区是一个系统的特定主题,但这些天几乎所有R平台使用相同的底层代码的Linux,Mac OS X上时,Solaris,AIX,FreeBSD上的Sun Java> = 1.4和Tcl> = 8.5,安装在Windows与R。

It is not in general possible to retrieve the system's own name(s) for the current timezone, but Sys.timezone will retrieve the name it uses for the current time (and the name may differ depending on whether daylight saving time is in effect).
这不是一般可以检索系统自己的名字(S)当前时区,但Sys.timezone将检索它为当前时间(名称可能不同,这取决于夏令时间是否是在使用的名称效应)。

On most platforms it is  possible to set the time zone via the environment variable TZ: see the section on "Time zone names" for suitable values.
在大多数平台上,它是可以设置时区,通过环境变量TZ:参见上节“时区名称为合适的值。

Note that the principal difficulty with time zones is their individual history: over the last 100 years places have changed their affiliation between major time zones, have opted out of (or in to) DST in various years or adopted rule changes late or not at all.  This often involves tiny administrative units in the US/Canada: Iowa had 23 different implementations of DST in the 1960's!
请注意,与时区的主要困难是他们的个人历史:在过去100多年的地方主要时区之间的关系已经改变,选择(或中)的DST在不同年份或迟到或不通过的规则变化。这往往涉及到微小的行政单位,在美国/加拿大:在1960年的爱荷华州有23个不同的DST实现!

Time zones did not come into use until the second half of the nineteenth century, and DST was first introduced in the early twentieth century, most widely during the First World War (in 1916).
时区没有投入使用,直到十九世纪的下半年,夏令时首次推出在二十世纪早期,在第一次世界大战(1916年),最广泛。


值----------Value----------

Sys.timezone returns an OS-specific character string, possibly an empty string.  Typically this is an abbreviation such as "EST".
Sys.timezone返回一个特定于操作系统的字符串,可能是一个空字符串。这通常是缩写为"EST"等。


时区名称----------Time zone names----------

Where OSes describe their valid time zones can be obscure.  The help for the C function tzset can be helpful, but it can also be inaccurate.  There is a cumbersome POSIX specification (listed under environment variable TZ at http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08), which is often at least partially supported, but there usually are other more user-friendly ways to specify timezones.
在操作系统描述其有效的时区可以是含糊不清的。 C函数tzset帮助可以是有益的,但它也可以是不准确的。有一个繁琐的POSIX规范(列在环境变量TZhttp://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08),这往往是至少部分支持,但也有通常是其他用户更加友好的方式来指定时区。

Many systems make use of a timezone database compiled by Arthur Olson, in which the preferred way to refer to a time zone by a location (typically of a city) e.g. Europe/London, America/Los_Angeles, Pacific/Easter.  Some traditional designations are also allowed such as EST5EDT or GB.  (Beware that some of these designations may not be what you think: in particular EST is a time zone used in Canada without daylight savings time, and not EST5EDT nor (Australian) Eastern Standard Time.)  The designation can also be an optional colon prepended to the path to a file giving complied zone information (and the examples above are all files in a system-specific location).  See http://www.twinsun.com/tz/tz-link.htm for more details and references.
许多系统由亚瑟·奥尔森的首选方式是指在一个时区的位置(通常是一个城市)如编译一个时区数据库的使用Europe/London,America/Los_Angeles,Pacific/Easter。还允许一些传统的名称,如EST5EDT或GB。 (注意,这些名称可能不是你的想法:特别EST是在加拿大没有夏令时的时区,而不是EST5EDT也不(澳大利亚)东部标准时间)。指定也可以是一个可选的冒号前面的文件,符合区域信息(和上面的例子是在一个系统的具体位置的所有文件)的路径。看到更多的细节和参考http://www.twinsun.com/tz/tz-link.htm。

R under Windows uses the Olson database.  The current version of the database will be given in file "<VAR>R_HOME</VAR>\share\zoneinfo\VERSION". Environment variable TZDIR can be used to point to a later "zoneinfo" directory.  A file listing most known time zones can be found at "<VAR>R_HOME</VAR>\share\zoneinfo\zone.tab" (see "Examples").
Windows下R采用Olson数据库。当前版本的数据库将在文件<VAR>R_HOME</VAR>\share\zoneinfo\VERSION。环境变量TZDIR可以用来指向以后zoneinfo目录。在文件列表中最出名的时区可以找到<VAR>R_HOME</VAR>\share\zoneinfo\zone.tab(见“的例子”)。

An attempt is made (once only per session) to map Windows' idea of the current time zone to a location, following an earlier version of http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml If this is not successful, it can be overridden by setting the TZ environment variable.
试图(只有一次,每节)Windows的地图当前时区位置的想法,后的http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml的早期版本如果这是不能成功的,它可以是重写TZ环境变量设置。

Windows documents a specification of the form GST-1GDT: this is interpreted as POSIX-like and hence the "US rules" for changing to/from DST are applied (and are incorrect for Germany).  Versions of R prior to 2.7.0 used Windows' system functions and hence this form: it is still accepted for backwards compatibility but was (and remains) unreliable and gives a warning.
Windows文件的形式规范GST-1GDT:这是类似于POSIX的,因此“美国规则”应用改变到/从DST(德国不正确)的解释。研发到2.7.0之前的版本使用Windows的系统功能,因此这种形式:向后兼容性,但仍然接受(仍然)不可靠的,并给予警告。


注意----------Note----------

There is currently (since 2007) considerable disruption over changes to the timings of the DST transitions, aimed at energy conservation. These often have short notice and timezone databases may not be up to date (even if the OS has been updated recently).
目前有(自2007年起)以上的DST转换时序的变化,旨在节约能源的相当混乱。这些往往短时间内和时区的数据库未必是最新的(即使操作系统最近已更新)。

Note that except on Windows, the operation of time zones is an OS service, and even on Windows a third-party database is used and can be updated (see the section on "Time zone names").  Incorrect results will never be an R issue, so please ensure that you have the courtesy not to blame R for them.
需要注意的是,除了在Windows上,时区的运作,是一个操作系统服务,即使在Windows上使用第三方数据库和可更新(见上的“时区名称”一节)。不正确的结果将不会是一个R的问题,所以请确保您有礼貌,不能责怪他们&#341;。


参见----------See Also----------

Sys.time, as.POSIXlt.
Sys.time,as.POSIXlt。

http://en.wikipedia.org/wiki/Time_zone and http://www.twinsun.com/tz/tz-link.htm for extensive sets of links.
http://en.wikipedia.org/wiki/Time_zone和http://www.twinsun.com/tz/tz-link.htm广泛的链接集。


举例----------Examples----------


Sys.timezone()

tzfile <- file.path(R.home("share"), "zoneinfo", "zone.tab")
tzones <- read.delim(tzfile, row.names = NULL, header = FALSE,
    col.names = c("country", "coords", "name", "comments"),
    as.is = TRUE, fill = TRUE, comment.char = "#")[“)]
str(tzones$name)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-1-24 16:21 , Processed in 0.031472 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表