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

feat: Add 'as.nanoduration.difftime()' #106

Merged
merged 1 commit into from
Oct 15, 2022
Merged

feat: Add 'as.nanoduration.difftime()' #106

merged 1 commit into from
Oct 15, 2022

Conversation

trevorld
Copy link
Contributor

For external dependency reasons I assumed you are not interested in the similar method for lubridate::duration() objects:

setMethod("as.nanoduration", "Duration", function(x) {
    x <- as.numeric(x, "seconds")
    s <- as.integer(x) # seconds
    n <- as.integer(1e9 * (x - s)) # nanoseconds
    nanoduration(seconds = s, nanoseconds = n)
})

@eddelbuettel
Copy link
Owner

This looks useful too.

Could you let us know how many more of these you have planned? We are of the 'issue ticket before PR' school of thought and find it helps. Your PRs have been of very good quality, but it may help us to know how many more you have planned.

@eddelbuettel
Copy link
Owner

I presume we're all good here too @lsilvest ?

@lsilvest
Copy link
Collaborator

I presume we're all good here too @lsilvest ?

Yes, this should work.

@eddelbuettel eddelbuettel merged commit 8bf18bd into eddelbuettel:master Oct 15, 2022
@trevorld trevorld deleted the difftime branch October 15, 2022 21:12
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

Successfully merging this pull request may close these issues.

None yet

3 participants