about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-15 15:18:33 +0000
committerbors <bors@rust-lang.org>2018-07-15 15:18:33 +0000
commit7751885134ad2f49bd3de57d0c0f8114e42d927a (patch)
treea9b8d029074aae02393b79bee02c28c8c91b56d4
parent2d89320a9a842a167f6bb4dbcef6b6d4d00e7eb8 (diff)
parent9a86e3df991fc008ed96c0dce9d77b3dc1ff792c (diff)
downloadrust-7751885134ad2f49bd3de57d0c0f8114e42d927a.tar.gz
rust-7751885134ad2f49bd3de57d0c0f8114e42d927a.zip
Auto merge of #52372 - KarolinePlum:Duration-rounding-documentation, r=joshtriplett
Document rounding down in std::time::Durations's subsec_millis etc.

Now also the documentations of `subsec_millis`, `subsec_micros`, `as_millis` and `as_micros` make clear that the fractional nanosecond component is rounded down to whole units.

Fixed #52263
-rw-r--r--src/libcore/time.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/time.rs b/src/libcore/time.rs
index 25721b7fcec..54973b7b778 100644
--- a/src/libcore/time.rs
+++ b/src/libcore/time.rs
@@ -208,7 +208,7 @@ impl Duration {
     #[inline]
     pub const fn as_secs(&self) -> u64 { self.secs }
 
-    /// Returns the fractional part of this `Duration`, in milliseconds.
+    /// Returns the fractional part of this `Duration`, in whole milliseconds.
     ///
     /// This method does **not** return the length of the duration when
     /// represented by milliseconds. The returned number always represents a
@@ -228,7 +228,7 @@ impl Duration {
     #[inline]
     pub const fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI }
 
-    /// Returns the fractional part of this `Duration`, in microseconds.
+    /// Returns the fractional part of this `Duration`, in whole microseconds.
     ///
     /// This method does **not** return the length of the duration when
     /// represented by microseconds. The returned number always represents a
@@ -268,7 +268,7 @@ impl Duration {
     #[inline]
     pub const fn subsec_nanos(&self) -> u32 { self.nanos }
 
-    /// Returns the total number of milliseconds contained by this `Duration`.
+    /// Returns the total number of whole milliseconds contained by this `Duration`.
     ///
     /// # Examples
     ///
@@ -285,7 +285,7 @@ impl Duration {
         self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128
     }
 
-    /// Returns the total number of microseconds contained by this `Duration`.
+    /// Returns the total number of whole microseconds contained by this `Duration`.
     ///
     /// # Examples
     ///