jasont@indigoindustrial.co.nz
2002-Apr-18 12:13 UTC
[Rd] strptime mysteriously adds a day - 0S-specific: Linux and Windows (so far) (PR#1466)
strptime() mysteriously adds a day to a date, unless the year is specified. Tested on: Linux (RedHat 6.0) - R version 1.4.1 and R-devel. Windows - R version 1.4.1 Bug isn't found on OpenBSD, R version 1.4.1. Transcript: R : Copyright 2002, The R Development Core Team Version 1.4.1 (2002-01-30) ...> ## BUG: > ## strptime seems to add a day to the request, unless the year > ## is added as part of the format. > strptime("11 Apr 22:00",format="%d %b %H:%M")[1] "2002-04-12 22:00:00 NZST"> ## note - we gained a day. > > ## goes away if we include the year > strptime("11 Apr 22:00 2002",format="%d %b %H:%M %Y")[1] "2002-04-11 22:00:00 NZST"> ## R 1.4.1, running on Linux RH 6.0. > version_ platform i586-pc-linux-gnu arch i586 os linux-gnu system i586, linux-gnu status major 1 minor 4.1 year 2002 month 01 day 30 language R> ## Bug also appears in R-devel (downloaded 16 April 2002). > ## For R-devel: > versionplatform i586-pc-linux-gnu arch i586 os linux-gnu system i586, linux-gnu status Under development (unstable) major 1 minor 5.0 year 2002 month 04 day 16 language R> ## Have also reproduced identical results in the Windows verion > version_ platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 4.1 year 2002 month 01 day 30 language R> ## > ## Unable to reproduce bug under OpenBSD 3.0 > version_ platform i386-unknown-openbsd3.0 arch i386 os openbsd3.0 system i386, openbsd3.0 status major 1 minor 4.1 year 2002 month 01 day 30 language R> ## <speculation> > ## This looks very OS specific. > ## </speculation>-- Indigo Industrial Controls Ltd. 64-21-343-545 jasont@indigoindustrial.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Martin Maechler
2002-Apr-18 12:41 UTC
[Rd] strptime mysteriously adds a day - 0S-specific: Linux and Windows (so far) (PR#1466)
>>>>> "Jason" == Jason Turner <jasont@indigoindustrial.co.nz> writes:Jason> strptime() mysteriously adds a day to a date, unless the year Jason> is specified. Tested on: Jason> Linux (RedHat 6.0) - R version 1.4.1 and R-devel. Jason> Windows - R version 1.4.1 Jason> Bug isn't found on OpenBSD, R version 1.4.1. I confirm the bug (R-devel, Redhat 7.1) To reproduce, it's sufficient to work with "%d %B" or "%d %b" . What happens is that January and February work okay, and all months from March produce the problem, e.g.> strptime("28 Feb",format="%d %b")# ok[1] "2002-02-28"> strptime("19 March",format="%d %B")# wrong[1] "2002-03-20" Martin -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._