[R] bug in as.POSIXct ?

Gabor Grothendieck ggrothendieck at myway.com
Thu Dec 4 22:03:00 CET 2003



Not sure but perhaps this is related to bug PR#3646 reported in:

http://maths.newcastle.edu.au/~rking/R/devel/03b/0195.html


--- 
Date: Thu, 4 Dec 2003 11:20:15 -0600 
From: <apjaworski at mmm.com>
To: <r-help at stat.math.ethz.ch> 
Subject: [R] bug in as.POSIXct ? 

 
 
I think that there is a bug in the as.POSIXct function on Windows.

Here is what I get on Win2000, Pentium III machine in R 1.8.1.

> dd1 <- ISOdatetime(2003, 10, 26, 0, 59, 59)
> dd2 <- ISOdatetime(2003, 10, 26, 1, 0, 0)
> dd2 - dd1
Time difference of 1.000278 hours

Now, the 26th of October was the day that change to the standard time
occurred, so I suspect that this has something to do with that. In fact

> dd1
[1] "2003-10-26 00:59:59 Central Daylight Time"
> dd2
[1] "2003-10-26 01:00:00 Central Standard Time"

so it looks like the switch from CDT to CST happens at 1:00 (instead of
2:00 ?).

Since the only thing the difftime function does is unclass the as.POSIXct
values of its two arguments, the error seems to be in the as.POSIXct code.
I looked at the C code of the as.POSIXct function but I do not know enough
about R code and C handling of the time structures to find an error there.
Perhaps, the error is actually in the C library handling of time structures
on Windows machines.


All this seems to work fine in version 1.8.1 patched 11-24 on a Linux
machine, i.e. the above difference is 1second. However, the swicth between
CDT and CSD also accurs at 1:00.


Andy

__________________________________
Andy Jaworski
518-1-01
Process Laboratory
3M Corporate Research Laboratory
-----
E-mail: apjaworski at mmm.com
Tel: (651) 733-6092
Fax: (651) 736-3122




More information about the R-help mailing list