Fix Duration::{try_,}from_secs_f{32,64}(-0.0)

This commit is contained in:
beetrees
2022-10-14 15:51:20 +01:00
parent 9b0a099dfc
commit c9948f5c5f
3 changed files with 10 additions and 1 deletions

View File

@@ -1279,7 +1279,7 @@ macro_rules! try_from_secs {
const MANT_MASK: $bits_ty = (1 << $mant_bits) - 1;
const EXP_MASK: $bits_ty = (1 << $exp_bits) - 1;
if $secs.is_sign_negative() {
if $secs < 0.0 {
return Err(FromFloatSecsError { kind: FromFloatSecsErrorKind::Negative });
}