Skip to content

difftime arithmetic (PR#2345)

1 message · Barry Rowlingson

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


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

Example:
Time difference of 0 secs
 
  - thats fine
[1] 0
attr(,"units")
[1] "secs"
attr(,"class")
[1] "difftime"

 - d2 prints out with print.default, although it is of class(difftime)!
print.difftime isnt being called, even though:
[1] "difftime"
Time difference of 0 secs

 - d3 prints out fine.

But if I dput those three objects, the files look identical, and when dgetted
(dgot?) they all act the same.

But if instead I save() them and then load() them then d2 acts weird again.

 More weirdness:
[1] 0
attr(,"units")
[1] "secs"
 
 - as expected, but:
[1] 0
attr(,"units")
[1] "secs"
attr(,"class")
[1] "difftime"

 similarly for unclass(unclass(unclass(d2))) !

 Any ideas?

Barry Rowlingson
Lancaster University
Lancaster, UK