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

Include trailing 0 (always 9 digits) for easier scanning #9

Closed
mattdowle opened this issue Jan 26, 2017 · 4 comments
Closed

Include trailing 0 (always 9 digits) for easier scanning #9

mattdowle opened this issue Jan 26, 2017 · 4 comments

Comments

@mattdowle
Copy link
Contributor

For example, this looks like 7 nanoseconds on first glance :

> format(nanotime(cooked$rdsent[1]))
[1] "2016-09-28T15:30:00.00000007+00:00"

but you have to look closely to realize there's just 8 subsecond digits there. So it's actually 70 nanoseconds.

Current behaviour :

format(nanotime(as.integer64("1475076600000000070")))
[1] "2016-09-28T15:30:00.00000007+00:00"
format(nanotime(as.integer64("1475076600000000071")))
[1] "2016-09-28T15:30:00.000000071+00:00"

Desired behaviour :

format(nanotime(as.integer64("1475076600000000070")))
[1] "2016-09-28T15:30:00.000000070+00:00"
format(nanotime(as.integer64("1475076600000000071")))
[1] "2016-09-28T15:30:00.000000071+00:00"

@eddelbuettel
Copy link
Owner

Not me but the underlying CCTZ C++ library so ...

@eddelbuettel
Copy link
Owner

This line in the corresponding CCTZ source file is your friend. Witness:

R> library(nanotime)
R> matt <- nanotime(70)
R> format(matt)
[1] "1970-01-01T00:00:00.00000007+00:00"
R> options("nanotimeFormat"="%Y-%m-%d %H:%M:%E9S%Ez")  # force nine digits
R> format(matt)
[1] "1970-01-01 00:00:00.000000070+00:00"
R> 

eddelbuettel added a commit that referenced this issue Jan 26, 2017
Ops defined
as.integer64 converter
better default format (cf #9)
@eddelbuettel
Copy link
Owner

I made the change in this branch which also fixes the printing issue. Try that.

@eddelbuettel
Copy link
Owner

Thanks again for this, I folded it into master now.

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

No branches or pull requests

2 participants