]> git.lizzy.rs Git - rust.git/commitdiff
Make rounding down clear in duration documentation
authorKaroline Plum <karoline@plum-ge.de>
Sat, 14 Jul 2018 13:48:52 +0000 (15:48 +0200)
committerGitHub <noreply@github.com>
Sat, 14 Jul 2018 13:48:52 +0000 (15:48 +0200)
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.

src/libcore/time.rs

index 25721b7fcecbb8f93a317df1f99ddf4dcb4548ba..54973b7b7783a5e1240c6f3ee5031f89b7c2ae2f 100644 (file)
@@ -208,7 +208,7 @@ pub const fn from_nanos(nanos: u64) -> 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 @@ pub const fn as_secs(&self) -> u64 { self.secs }
     #[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 @@ pub const fn subsec_micros(&self) -> u32 { self.nanos / NANOS_PER_MICRO }
     #[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 @@ pub fn as_millis(&self) -> u128 {
         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
     ///