[Rd] difftime arithmetic (PR#2345)

maechler@stat.math.ethz.ch maechler@stat.math.ethz.ch
Wed Dec 4 18:09:06 2002


>>>>> "BaRow" == B Rowlingson <B.Rowlingson@lancaster.ac.uk>
>>>>>     on Wed, 4 Dec 2002 17:58:51 +0100 (MET) writes:

    BaRow> Full_Name: Barry Rowlingson Version: 1.6.0 OS: RH8
    BaRow> i386 Submission from: (NULL) (148.88.136.205)

    BaRow> Strange things happen if I premultiply a difftime()
    BaRow> object with a number.

Thank you for the bug report!
Well, it's ``just'' the internal  object bit that got lost -> is.object()

The bug is still there in R-devel,
and a shorter example is

> now <- Sys.time(); d1 <- difftime(now,now); d2 <- 1 * d1
> d1
Time difference of 0 secs
> d2
[1] 0
attr(,"units")
[1] "secs"
attr(,"class")
[1] "difftime"

> is.object(d1)
[1] TRUE
> is.object(d2)
[1] FALSE

----

We will have to fix that in the C code, too.
Martin