Bug 17277 - all.equal(POSIXt, numeric) throws error instead of describing difference
Summary: all.equal(POSIXt, numeric) throws error instead of describing difference
Alias: None
Product: R
Classification: Unclassified
Component: Misc (show other bugs)
Version: 3.4.0
Hardware: Other Other
: P5 normal
Assignee: R-core
Depends on:
Reported: 2017-05-26 01:13 UTC by Bill Dunlap
Modified: 2017-05-26 14:40 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Bill Dunlap 2017-05-26 01:13:06 UTC
> all.equal(as.POSIXlt("2016-05-25 18:03", tz="US/Pacific"), 1464224580)
Error in as.POSIXct.numeric(current) : 'origin' must be supplied

I would like to see a description of the difference, not an error.
Comment 1 Bill Dunlap 2017-05-26 14:40:32 UTC
In addition, all.equal() returns TRUE plus a warning when comparing two POSIXt objects that represent the same time in different time zones.  I think all.equal() should not warn but include the time zone difference in its output.

> all.equal(as.POSIXct("2016-05-25 18:03", tz="US/Pacific"), as.POSIXct("2016-05-25 19:03", tz="US/Mountain"))
[1] TRUE
Warning message:
In check_tzones(target, current) : 'tzone' attributes are inconsistent
> as.numeric(as.POSIXct("2016-05-25 19:03", tz="US/Mountain"))
[1] 1464224580
> as.numeric(as.POSIXct("2016-05-25 18:03", tz="US/Pacific"))
[1] 1464224580