[R] Unexpected behavior of difftime in relationship to daylight savings time

From: Dennis Fisher <fisher_at_plessthan.com>
Date: Mon, 03 Nov 2008 12:49:11 -0800


Colleagues,

I just encountered some unexpected behavior of difftime in relationship to the change from daylight savings to standard time. My understanding is that DST and ST take effect at 2AM. However, the code below suggests that R (version 2.8.0 in OS X) implements the change at 2:16AM:

Expected:
> > difftime("2008-11-02 02:01:00", "2008-11-02 00:59:00")
> Time difference of 2.033333 hours
> > difftime("2008-11-02 01:16:00", "2008-11-02 01:15:00")
> Time difference of 1 mins
> > difftime("2008-11-02 01:18:00", "2008-11-02 01:17:00")
> Time difference of 1 mins

Not expected:
> > difftime("2008-11-02 01:17:00", "2008-11-02 01:16:00")
> Time difference of 1.016667 hours

Can anyone explain this?

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-415-564-2220
www.PLessThan.com

        [[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. Received on Mon 03 Nov 2008 - 20:52:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 03 Nov 2008 - 21:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive