[EMAIL PROTECTED] wrote: > Running under Windows XP 64 bit, as.POSIXlt()/as.POSIXct() seem > to think that US time zones (EST5EDT, MST7MDT) switched from daylight > savings back to standard time on Oct 28, 2007, whereas the switch > is actually on Sun Nov 04, 2007. > > =20 Not Our Problem. (This sort of thing never is. We are wholly dependent=20 on the OS for this information). Check out
http://support.microsoft.com/kb/933360 > Examples: > > > Sys.timezone() > [1] "Mountain Daylight Time" > > as.POSIXct("2007-10-30 12:38:47") > [1] "2007-10-30 12:38:47 Mountain Daylight Time" > > # *** Should report 2007-10-30 14:38:47 EDT: > > as.POSIXlt(as.POSIXct("2007-10-30 12:38:47"), "EST5EDT") > [1] "2007-10-30 13:38:47 EST" > > Sys.time() > [1] "2007-11-01 09:22:28 Mountain Daylight Time" > > > # Bad behavior is manifested in different ways with TZ=3D"MST7MDT" > > Sys.setenv(TZ=3D"MST7MDT") > > # *** Should report "12:38:47 MDT" > > as.POSIXct("2007-10-30 12:38:47") > [1] "2007-10-30 12:38:47 MST" > > as.POSIXlt(as.POSIXct("2007-10-30 12:38:47"), "EST5EDT") > [1] "2007-10-30 14:38:47 EST" > > # *** Should report "2007-11-01 09:23:09 MDT" > > Sys.time() > [1] "2007-11-01 08:23:09 MST" > > > > sessionInfo() > R version 2.6.0 Patched (2007-10-11 r43143) > i386-pc-mingw32 > > locale: > LC_COLLATE=3DEnglish_United States.1252;LC_CTYPE=3DEnglish_United State= s.1252;LC_MONETARY=3DEnglish_United States.1252;LC_NUMERIC=3DC;LC_TIME=3D= English_United States.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > > > > Furthermore, with the timezone "Mountain Daylight Time" > (which is the default I get when I start R), the switch > appears to be on Nov 5 in 2006, whereas it actually was > on Oct 29 in 2006. > > > # New R session > > Sys.timezone() > [1] "Mountain Daylight Time" > > # *** wrong switch in 2006 *** > > as.POSIXct("2006-10-30 12:38:47")+(-4:7)*(24*3600) > [1] "2006-10-26 12:38:47 Mountain Daylight Time" > [2] "2006-10-27 12:38:47 Mountain Daylight Time" > [3] "2006-10-28 12:38:47 Mountain Daylight Time" > [4] "2006-10-29 12:38:47 Mountain Daylight Time" > [5] "2006-10-30 12:38:47 Mountain Daylight Time" > [6] "2006-10-31 12:38:47 Mountain Daylight Time" > [7] "2006-11-01 12:38:47 Mountain Daylight Time" > [8] "2006-11-02 12:38:47 Mountain Daylight Time" > [9] "2006-11-03 12:38:47 Mountain Daylight Time" > [10] "2006-11-04 12:38:47 Mountain Daylight Time" > [11] "2006-11-05 11:38:47 Mountain Standard Time" > [12] "2006-11-06 11:38:47 Mountain Standard Time" > > as.POSIXct("2007-10-30 12:38:47")+(-4:7)*(24*3600) > [1] "2007-10-26 12:38:47 Mountain Daylight Time" > [2] "2007-10-27 12:38:47 Mountain Daylight Time" > [3] "2007-10-28 12:38:47 Mountain Daylight Time" > [4] "2007-10-29 12:38:47 Mountain Daylight Time" > [5] "2007-10-30 12:38:47 Mountain Daylight Time" > [6] "2007-10-31 12:38:47 Mountain Daylight Time" > [7] "2007-11-01 12:38:47 Mountain Daylight Time" > [8] "2007-11-02 12:38:47 Mountain Daylight Time" > [9] "2007-11-03 12:38:47 Mountain Daylight Time" > [10] "2007-11-04 11:38:47 Mountain Standard Time" > [11] "2007-11-05 11:38:47 Mountain Standard Time" > [12] "2007-11-06 11:38:47 Mountain Standard Time" > > Sys.setenv(TZ=3D"MST7MDT") > > Sys.timezone() > [1] "MST" > > as.POSIXct("2006-10-30 12:38:47")+(-4:7)*(24*3600) > [1] "2006-10-26 13:38:47 MDT" "2006-10-27 13:38:47 MDT" > [3] "2006-10-28 13:38:47 MDT" "2006-10-29 12:38:47 MST" > [5] "2006-10-30 12:38:47 MST" "2006-10-31 12:38:47 MST" > [7] "2006-11-01 12:38:47 MST" "2006-11-02 12:38:47 MST" > [9] "2006-11-03 12:38:47 MST" "2006-11-04 12:38:47 MST" > [11] "2006-11-05 12:38:47 MST" "2006-11-06 12:38:47 MST" > > # *** wrong switch in 2007 *** > > as.POSIXct("2007-10-30 12:38:47")+(-4:7)*(24*3600) > [1] "2007-10-26 13:38:47 MDT" "2007-10-27 13:38:47 MDT" > [3] "2007-10-28 12:38:47 MST" "2007-10-29 12:38:47 MST" > [5] "2007-10-30 12:38:47 MST" "2007-10-31 12:38:47 MST" > [7] "2007-11-01 12:38:47 MST" "2007-11-02 12:38:47 MST" > [9] "2007-11-03 12:38:47 MST" "2007-11-04 12:38:47 MST" > [11] "2007-11-05 12:38:47 MST" "2007-11-06 12:38:47 MST" > > > > I see this behavior on all the Windows systems I have tried: > Windows XP 64 bit, Windows XP 32 bit Pro, Windows XP home, > Windows 2000, with a variety of R versions. The systems > have all relevant Windows updates applied (unless some were > inadvertently missed) and the systems otherwise appear to > behave correctly with respect to times and timezones. > > I do not see this problem on Ubuntu Linux systems. > > -- Tony Plate > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > =20 --=20 O__ ---- Peter Dalgaard =D8ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327= 918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327= 907 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel