Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timestamp precision issue #11

Closed
eddelbuettel opened this issue Jan 13, 2018 · 3 comments
Closed

timestamp precision issue #11

eddelbuettel opened this issue Jan 13, 2018 · 3 comments

Comments

@eddelbuettel
Copy link
Owner

@eddelbuettel eddelbuettel commented Jan 13, 2018

@traversc: I had this for me once at home, and once at Travis. I think identical is too strict:

> library(RcppMsgPack)
> mt <- Sys.time()
> attr(mt, "tzone") <- "UTC"
> mp <- msgpack_pack(msgpack_timestamp_encode(mt))
> mt <- Sys.time()
> attr(mt, "tzone") <- "UTC"
> mp <- msgpack_pack(msgpack_timestamp_encode(mt))
> mtu <- msgpack_timestamp_decode(msgpack_unpack(mp))
> stopifnot(identical(mt, mtu))
Error: identical(mt, mtu) is not TRUE
> mt
[1] "2018-01-13 03:04:21 UTC"
> mtu
[1] "2018-01-13 03:04:21 UTC"
> mt - mtu
Time difference of -2.384186e-07 secs
> all.equal(mt,mtu)
[1] TRUE
> 

all.equal would do. For POSIXct the resolution is actually less that -2.3e-07 as I recall.

(Another set of changes is just make the compiler a little more silent.)

@eddelbuettel
Copy link
Owner Author

@eddelbuettel eddelbuettel commented Jan 13, 2018

I will take care of both changes and will ping you when the PR is ready, ok?

@traversc
Copy link
Contributor

@traversc traversc commented Jan 13, 2018

Thank makes sense, thanks for catching that.

@eddelbuettel
Copy link
Owner Author

@eddelbuettel eddelbuettel commented Jan 13, 2018

Fixed in #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.