[R] Incorrect DST time changes in DateTimeClasses

Andrew Digby andrewdigby at mac.com
Sat Dec 8 04:46:43 CET 2012


Thanks for confirming that it's a wider problem. I thought that /etc/localtime on my machine was the Olsen database, but presumably not, since the DST changes are correct in that file. Unless R is reading that file incorrectly?

I've ended up using chron (which ignores time zones and DST) and a custom DST file as a workaround.

Thanks again.

On 7/12/2012, at 11:20 , Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:

> I see this discontinuity at '2010-04-04 02:26:05' on my Windows 7 x64 with R 2.15.2. I also see it for time zone "America_Los_Angeles" at '2010-11-07 01:23:09'.
> 
> I am not entirely sure what the "correct" behavior should be, since the string does not specify whether it is in daylight or standard time, even though it could be either for any time between 2:00 and 3:00 (or 1:00 and 2:00 for "America/Los_Angeles").
> 
> In any event, if this is an issue it appears to be an Olsen timezone database issue, not an R issue.
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                      Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> --------------------------------------------------------------------------- 
> Sent from my phone. Please excuse my brevity.
> 
> Andrew Digby <andrewdigby at mac.com> wrote:
> 
>> 
>> Apologies - I intended to add that info at the end: OS X 10.8.2 and R
>> 2.15.1.
>> 
>> Many thanks.
>> 
>>> R.Version()
>> $platform
>> [1] "x86_64-apple-darwin9.8.0"
>> $arch
>> [1] "x86_64"
>> $os
>> [1] "darwin9.8.0"
>> $system
>> [1] "x86_64, darwin9.8.0"
>> $status
>> [1] ""
>> $major
>> [1] "2"
>> $minor
>> [1] "15.1"
>> $year
>> [1] "2012"
>> $month
>> [1] "06"
>> $day
>> [1] "22"
>> $`svn rev`
>> [1] "59600"
>> $language
>> [1] "R"
>> $version.string
>> [1] "R version 2.15.1 (2012-06-22)"
>> $nickname
>> [1] "Roasted Marshmallows"
>> 
>> 
>> On 7/12/2012, at 04:29 , Uwe Ligges <ligges at statistik.tu-dortmund.de>
>> wrote:
>> 
>>> 
>>> 
>>> On 06.12.2012 15:54, Jeff Newmiller wrote:
>>>> What OS are you using? It makes a difference.
>>> 
>>> ... and R version.
>>> 
>>> Uwe Ligges
>>> 
>>>> 
>> ---------------------------------------------------------------------------
>>>> Jeff Newmiller                        The     .....       .....  Go
>> Live...
>>>> DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#. 
>> Live Go...
>>>>                                      Live:   OO#.. Dead: OO#.. 
>> Playing
>>>> Research Engineer (Solar/Batteries            O.O#.       #.O#. 
>> with
>>>> /Software/Embedded Controllers)               .OO#.       .OO#. 
>> rocks...1k
>>>> 
>> ---------------------------------------------------------------------------
>>>> Sent from my phone. Please excuse my brevity.
>>>> 
>>>> Andrew Digby <andrewdigby at mac.com> wrote:
>>>> 
>>>>> 
>>>>> Can anyone please shed any light on why R DateTimeClasses give
>> weird
>>>>> times for when daylight saving time information changes, and which
>>>>> aren't consistent with the OS?
>>>>> 
>>>>> Example:
>>>>> 
>>>>> 	Expected result: in New Zealand DST stopped (NZDT -> NZST) at
>> 03:00
>>>>> NZDT on 2010-04-04, as confirmed by the OS time zone info (OS X
>>>>> 10.8.2):
>>>>> 
>>>>> 	zdump -v /etc/localtime
>>>>> 		/etc/localtime  Sat Apr  3 13:59:59 2010 UTC = Sun Apr  4
>> 02:59:59
>>>>> 2010 NZDT isdst=1
>>>>> 		/etc/localtime  Sat Apr  3 14:00:00 2010 UTC = Sun Apr  4
>> 02:00:00
>>>>> 2010 NZST isdst=0
>>>>> 
>>>>> 	Result in R: R has DST changing at 02:26:08, instead of 03:00!
>>>>> 
>>>>> 	> a<-as.POSIXlt('2010-04-04 02:26:07',tz="NZ")
>>>>> 	> a$isdst
>>>>> 	[1] 1
>>>>> 	> b<-as.POSIXlt('2010-04-04 02:26:08',tz="NZ")
>>>>> 	> b$isdst
>>>>> 	[1] 0
>>>>> 
>>>>> 
>>>>> So does R get its DST information from somewhere else? Any
>> suggestions
>>>>> would be much appreciated!
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> 	[[alternative HTML version deleted]]
>>>>> 
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>> 
>>>> ______________________________________________
>>>> R-help at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>>>> and provide commented, minimal, self-contained, reproducible code.
>>>> 
>




More information about the R-help mailing list