未知时区'localtime'

时间:2015-11-09 19:01:00

标签: r azure timezone

我认为我已经做好了一切,但为什么我会这样做:

> Sys.time()
[1] "2015-11-09 18:51:17 UTC"
Warning messages:
1: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'localtime'
2: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'localtime'
> 

操作系统是Windows Server 2012(实际上是Azure VM)。我已将时区设置为UTC,其中包含TZ环境变量:

enter image description here

Sys.timezone显然看到了:

> Sys.timezone()
[1] "UTC"
> 

它甚至列在我的OlsonNames()

enter image description here

我在降价时收到大量这些错误消息,这让我发疯了。不幸的是,我注意到与此相关的其他SO链接经常没有得到解决。

更新 - 每次请求我都会添加sessionInfo()输出:

> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2012 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] htmltools_0.2.6 tools_3.2.2     yaml_2.1.13     rmarkdown_0.8.1
[5] digest_0.6.8   
> 

和追溯:

> options(warn=2)
> Sys.time()
Error in as.POSIXlt.POSIXct(x, tz) : 
  (converted from warning) unknown timezone 'localtime'
> traceback()
13: doWithOneRestart(return(expr), restart)
12: withOneRestart(expr, restarts[[1L]])
11: withRestarts({
        .Internal(.signalCondition(simpleWarning(msg, call), msg, 
            call))
        .Internal(.dfltWarn(msg, call))
    }, muffleWarning = function() NULL)
10: .signalSimpleWarning("unknown timezone 'localtime'", quote(as.POSIXlt.POSIXct(x, 
        tz)))
9: as.POSIXlt.POSIXct(x, tz)
8: as.POSIXlt(x, tz)
7: format.POSIXlt(as.POSIXlt(x, tz), format, usetz, ...)
6: structure(format.POSIXlt(as.POSIXlt(x, tz), format, usetz, ...), 
       names = names(x))
5: format.POSIXct(x, usetz = TRUE)
4: format(x, usetz = TRUE)
3: print(format(x, usetz = TRUE), ...)
2: print.POSIXct(x)
1: function (x, ...) 
   UseMethod("print")(x)
> 

更新更多信息: enter image description here

1 个答案:

答案 0 :(得分:2)

看起来是R 3.2.2中的已知错误,并在3.2.3中修复,每this issue report