-
Notifications
You must be signed in to change notification settings - Fork 543
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
Panicked at duration_round by zero #658
Comments
ARBaart
pushed a commit
to ARBaart/chrono
that referenced
this issue
Mar 21, 2022
ARBaart
pushed a commit
to ARBaart/chrono
that referenced
this issue
Mar 21, 2022
Would you be able to submit a PR? I notice you're already working on a fix. |
Yes, see #659 |
djc
pushed a commit
that referenced
this issue
Mar 21, 2022
botahamec
pushed a commit
to botahamec/chrono
that referenced
this issue
May 26, 2022
pickfire
pushed a commit
to pickfire/chrono
that referenced
this issue
Jul 5, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I ran into the following panic error in my Rust project using the duration_round method of chrono. The error is
In the current master I think this corresponds to the following line:
chrono/src/round.rs
Line 188 in ea6412b
It seems like duration_round doesn't check if the amount it is rounded by is zero, because the remainder operation (%) panics when used with zero as rhs. While rounding by zero doesn't make a lot of sense, the expected behaviour in the limit from higher values should probably be to just return the original value, unrounded.
Using Rust 1.56.0 and chrono 0.4.19
The text was updated successfully, but these errors were encountered: