未知时区 'localtime'

unknown timezone 'localtime'

我认为我做的一切都是对的,但为什么我会得到这个:

> 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)。我已使用 TZ 环境变量将我的时区设置为 UTC:

Sys.timezone显然看到了:

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

它甚至列在我的 OlsonNames():

我在 markdown 中收到大量此类错误消息,这让我发疯。不祥的是,我注意到与此相关的其他 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)
> 

更新 更多信息:

根据 this issue report

看起来是 R 3.2.2 中的已知错误并在 3.2.3 中修复