[Rd] strptime problem for 2004-10-03 02:00:00

Michael Sumner mdsumner at utas.edu.au
Wed Oct 26 23:33:34 CEST 2005


Great.  Thanks for confirmation.

Cheers, Mike.

 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

----------------------------

Message: 16
Date: Tue, 25 Oct 2005 21:33:54 +0100 (BST)
From: Prof Brian Ripley <ripley at stats.ox.ac.uk>
Subject: Re: [Rd] strptime problem for 2004-10-03 02:00:00
To: Michael Sumner <mdsumner at utas.edu.au>
Cc: r-devel at stat.math.ethz.ch
Message-ID: <Pine.LNX.4.61.0510252030330.24595 at gannet.stats>
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed

It's a bug, a rather rare one.  2004-10-03 02:00:00 does not exist in your 
time zone, and in trying to find out if the time is on DST or not it has 
failed to find out.  It needs to be told that GMT is never on DST so not 
to bother.

On Linux, running R with TZ="GMT" set should fix this.  Windows is harder 
to control since it does not distinguish the UK timezone from GMT.

There is a bugfix now in R-devel.  It may migrate to R-patched in due 
course.

On Tue, 25 Oct 2005, Michael Sumner wrote:


>> Hello, I at first thought this was a system or locale issue, but since
>> it occurs on
>> both Windows and Linux and only for 2004 (AFAIK) I report it.
>>
>> I have a problem with as.POSIXct for the hour between
>> "2004-10-03 02:00:00 GMT" and "2004-10-03 02:59:59 GMT".
>>
>> In short, the 2 AM (GMT) hour in 2004 (but not in other years) is
>> interpreted as 1 AM by strptime:
>> (I use ISOdatetime as a convenience).
>>
>> ## Windows XP
>>
>> ISOdatetime(2004, 10, 3, 2, 0, 0,  tz = "GMT")
>> ##[1] "2004-10-03 01:00:00 GMT"
>> ISOdatetime(2004, 10, 3, 1, 0, 0,  tz = "GMT")
>> ##[1] "2004-10-03 01:00:00 GMT"
>>
>> ISOdatetime(2005, 10, 3, 2, 0, 0,  tz = "GMT")
>> ##[1] "2005-10-03 02:00:00 GMT"
>> ISOdatetime(2005, 10, 3, 1, 0, 0,  tz = "GMT")
>> ## [1] "2005-10-03 01:00:00 GMT"
>>
>



More information about the R-devel mailing list