[Rd] strange behaviour when converting from char to POSIX
(PR#6422)
Prof Brian D Ripley
ripley at stats.ox.ac.uk
Fri Jan 9 18:48:54 MET 2004
What exactly is strange, apart from posting a question as a bug report?
Please do read the R FAQ and don't misuse R-bugs to ask questions.
Hint: you most likely specified a non-existent time. When did your locale
switch to DST in 1993? I don't know, of course (you haven't told us your
locale) but I bet it was that day. That means the time you specified does
not exist if your locale switched at the same time as the UK (and I bet it
did).
Here's my evidence (WinXP)
> as.POSIXct(strptime("19930870001","%Y%j%H%M")) -> foo
> foo
[1] "1993-03-28 00:01:00 GMT Standard Time"
> foo+3480
[1] "1993-03-28 00:59:00 GMT Standard Time"
> foo+3540
[1] "1993-03-28 02:00:00 GMT Daylight Time"
On Fri, 9 Jan 2004 christoph.schmutz at meteoschweiz.ch wrote:
> Full_Name: Christoph Schmutz, MeteoSchweiz, Switzerland
> Version: R1.7.1, R1.8.1
> OS: windows2000, solaris sunOS 5.8
> Submission from: (NULL) (141.249.133.6)
>
>
>
> I'm not sure if I don't get the clue, but please consider this:
> > strptime("19930870150","%Y%j%H%M")
> [1] "1993-03-28 01:50:00"
> > strptime("19930870250","%Y%j%H%M")
> [1] "1993-03-28 01:50:00"
> > strptime("19930870350","%Y%j%H%M")
> [1] "1993-03-28 03:50:00"
>
> The behaviour is the same with R1.7.1 on Window2000 as on a R1.8.1 on sunOS
> 5.8.
So it is probably intended, then!
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list