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

Add subsec methods to Duration #1348

Open
botahamec opened this issue Nov 1, 2023 · 1 comment
Open

Add subsec methods to Duration #1348

botahamec opened this issue Nov 1, 2023 · 1 comment

Comments

@botahamec
Copy link
Contributor

botahamec commented Nov 1, 2023

The standard library's Duration type has two useful methods:

  • subsec_micros
  • subsec_millis

This has the benefit of returning a u32 instead of a Option<i64>. I suggest the same three methods be added to chrono 0.4. I see we already have subsec_nanos in the 0.4.x branch, although it wasn't released yet. So this proposal just adds the two remaining methods.

Also, for consistency, should this method be called subsec_nanoseconds instead of subsec_nanos? That's what's used in DateTime.

@djc
Copy link
Member

djc commented Nov 1, 2023

Let's be consistent with the recent addition and std over the older APIs. Happy to review a PR for this!

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 a pull request may close this issue.

2 participants