I am running R 2.3.1 on Windows XP. My machine is set (via the Windows Control Panel) to Central European time (Amsterdam, Berlin, Rome, Stockholm, Vienna) and automatically has DST set, so I am 2 hours ahead of GMT. No TZ variable is set.
> Sys.timezone() [1] "W. Europe Standard Time" > Sys.Date() [1] "2006-08-15" > as.POSIXlt(Sys.Date()) [1] "2006-08-15" > as.POSIXct(Sys.Date()) [1] "2006-08-15 02:00:00 W. Europe Standard Time" > as.POSIXct(as.POSIXlt(Sys.Date())) [1] "2006-08-15 01:00:00 W. Europe Standard Time" Converting to POSIXct and converting to POSIXlt and then to POSIXct produces different results, which is rather strange. When I do > Sys.time() [1] "2006-08-16 00:12:40 W. Europe Standard Time" I get my clock time with numerically correct time for my location, but with an incorrect timezone stamp. If I set TZ=CET, something else happens. It is just past midnight, my Windows system clock shows 12:33 AM, and the date is Aug 16 (here in Austria) With TZ=CET, > Sys.Date() [1] "2006-08-15" > Sys.time() [1] "2006-08-15 22:33:30 CET" So I get current GMT time (my time - 2 hours) and date, but with a CET time stamp. When TZ does not have a value, > Sys.Date() [1] "2006-08-16" > Sys.time() [1] "2006-08-16 00:32:37 W. Europe Standard Time" This is numerically correct time and date, but with an incorrect timezone stamp. So I never get completely correct information, even when Windows timezone information is correct and TZ has the correct value. Is this something which should be corrected? -- Erich Neuwirth, University of Vienna Faculty of Computer Science Computer Supported Didactics Working Group Visit our SunSITE at http://sunsite.univie.ac.at Phone: +43-1-4277-39464 Fax: +43-1-4277-39459 ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel