about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-26 23:45:18 +0100
committerGitHub <noreply@github.com>2022-01-26 23:45:18 +0100
commitfaf2b7f45593112cdb000783663624ba071a74d4 (patch)
treebcd605b173d3a287579f82b39e4a593334345e00 /library/std
parenta7f375789bab1a4e4a291c963081a8ca7d2b6bd7 (diff)
parente0bcf771d6e670988a3d4fdc785ecd5857916f10 (diff)
downloadrust-faf2b7f45593112cdb000783663624ba071a74d4.tar.gz
rust-faf2b7f45593112cdb000783663624ba071a74d4.zip
Rollup merge of #90247 - newpavlov:duration_float_fract, r=nagisa
Improve Duration::try_from_secs_f32/64 accuracy by directly processing exponent and mantissa

Closes: #90225

The methods now implement direct processing of exponent and mantissa, which should result in the best possible conversion accuracy (modulo truncation, i.e. float value of 19.995 ns will be represented as 19 ns).
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/error.rs2
-rw-r--r--library/std/src/time.rs2
2 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/error.rs b/library/std/src/error.rs
index 643108b88bf..1a96b9c9282 100644
--- a/library/std/src/error.rs
+++ b/library/std/src/error.rs
@@ -602,7 +602,7 @@ impl Error for char::ParseCharError {
 impl Error for alloc::collections::TryReserveError {}
 
 #[unstable(feature = "duration_checked_float", issue = "83400")]
-impl Error for time::FromSecsError {}
+impl Error for time::FromFloatSecsError {}
 
 // Copied from `any.rs`.
 impl dyn Error + 'static {
diff --git a/library/std/src/time.rs b/library/std/src/time.rs
index b6867e68df7..b4f9d8ea28d 100644
--- a/library/std/src/time.rs
+++ b/library/std/src/time.rs
@@ -45,7 +45,7 @@ use crate::sys_common::FromInner;
 pub use core::time::Duration;
 
 #[unstable(feature = "duration_checked_float", issue = "83400")]
-pub use core::time::FromSecsError;
+pub use core::time::FromFloatSecsError;
 
 /// A measurement of a monotonically nondecreasing clock.
 /// Opaque and useful only with [`Duration`].