See FAQ 7.31 or explain what you believe to be the problem. On Feb 16, 2008 1:05 PM, <[EMAIL PROTECTED]> wrote: > Full_Name: Bo Zhou > Version: 2.6.1 (2007-11-26) > OS: Windows XP > Submission from: (NULL) (207.237.54.242) > > > Hi, > > I found an arithmetic problem when I'm doing something with POSIXct > The code to reproduce it is as follows (This is the recommended way of finding > out time zone difference on R News 2004-1 Page 32 URL > http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf) > > a=Sys.time() > b<-as.POSIXct(format(a,tz="GMT")) > a-b > unclass(a) > unclass(b) > unclass(a)-unclass(b) > as.numeric(a) > as.numeric(b) > as.numeric(a)-as.numeric(b) > > The result on my machine > > > a=Sys.time() > > b<-as.POSIXct(format(a,tz="GMT")) > > a-b > Time difference of -4.999969 hours > > unclass(a) > [1] 1203184447 > > unclass(b) > [1] 1203202447 > attr(,"tzone") > [1] "" > > unclass(a)-unclass(b) > [1] -17999.89 > attr(,"tzone") > [1] "" > > as.numeric(a) > [1] 1203184447 > > as.numeric(b) > [1] 1203202447 > > as.numeric(a)-as.numeric(b) > [1] -17999.89
______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel