[Rd] Possible POSIXlt / wday glitch & bugs.r-project.org status

Imanuel Costigan i.costigan at me.com
Fri Oct 4 12:11:02 CEST 2013

Wanted to raise two questions:

1. Is bugs.r-project.org down? I haven't been able to reach it for two or three days:

ping bugs.r-project.org
PING rbugs.research.att.com ( 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6

2. Is wday element of POSIXlt meant to be timezone invariant? You would expect the wday element to be invariant to the timezone of a date. That is, the same date/time instant of 5th October 2013 in both Australia/Sydney and UTC should be a Saturday (i.e. wday = 6). And indeed that is the case with 1 min past midnight on 5 October 2013:

d_utc <- ymd_hms(20131005000001, tz='UTC')
d_local <- ymd_hms(20131005000001, tz='Australia/Sydney')
as.POSIXlt(x=d_utc, tz=tz(d_utc))$wday # 6
as.POSIXlt(x=d_local, tz=tz(d_local))$wday # 6

But this isn't always the case. For example,

d_utc <- ymd_hms(20381002000001, tz='UTC')
d_local <- ymd_hms(20381002000001, tz='Australia/Sydney')
as.POSIXlt(x=d_utc, tz=tz(d_utc))$wday # 6
as.POSIXlt(x=d_local, tz=tz(d_local))$wday # 5

Is this expected behaviour? I would have expected a properly encoded date/time of 2 Oct 2038 to be a Saturday irrespective of its time zone.

Obligatory system dump:

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin12.4.0 (64-bit)

[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

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

other attached packages:
[1] lubridate_1.3.0 testthat_0.7.1  devtools_1.3   

loaded via a namespace (and not attached):
 [1] colorspace_1.2-4   dichromat_2.0-0    digest_0.6.3       evaluate_0.5.1    
 [5] ggplot2_0.9.3.1    grid_3.0.1         gtable_0.1.2       httr_0.2          
 [9] labeling_0.2       MASS_7.3-29        memoise_0.1        munsell_0.4.2     
[13] parallel_3.0.1     plyr_1.8           proto_0.3-10       RColorBrewer_1.0-5
[17] RCurl_1.95-4.1     reshape2_1.2.2     scales_0.2.3       stringr_0.6.2     
[21] tools_3.0.1        whisker_0.3-2     


Using R compiled by homebrew [1]. But also experiencing the same bug using R installed on Windows 7 from the CRAN binaries.

For those interested, I've also noted this on the `lubridate` Github issues page [2], even though this doesn't appear to be a lubridate issue.

Thanks for any help.

[1] http://brew.sh
[2] https://github.com/hadley/lubridate/issues/209

More information about the R-devel mailing list