Skip to content

Commit 7751885

Browse files
committed
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
2 parents 2d89320 + 9a86e3d commit 7751885

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libcore/time.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl Duration {
208208
#[inline]
209209
pub const fn as_secs(&self) -> u64 { self.secs }
210210

211-
/// Returns the fractional part of this `Duration`, in milliseconds.
211+
/// Returns the fractional part of this `Duration`, in whole milliseconds.
212212
///
213213
/// This method does **not** return the length of the duration when
214214
/// represented by milliseconds. The returned number always represents a
@@ -228,7 +228,7 @@ impl Duration {
228228
#[inline]
229229
pub const fn subsec_millis(&self) -> u32 { self.nanos / NANOS_PER_MILLI }
230230

231-
/// Returns the fractional part of this `Duration`, in microseconds.
231+
/// Returns the fractional part of this `Duration`, in whole microseconds.
232232
///
233233
/// This method does **not** return the length of the duration when
234234
/// represented by microseconds. The returned number always represents a
@@ -268,7 +268,7 @@ impl Duration {
268268
#[inline]
269269
pub const fn subsec_nanos(&self) -> u32 { self.nanos }
270270

271-
/// Returns the total number of milliseconds contained by this `Duration`.
271+
/// Returns the total number of whole milliseconds contained by this `Duration`.
272272
///
273273
/// # Examples
274274
///
@@ -285,7 +285,7 @@ impl Duration {
285285
self.secs as u128 * MILLIS_PER_SEC as u128 + (self.nanos / NANOS_PER_MILLI) as u128
286286
}
287287

288-
/// Returns the total number of microseconds contained by this `Duration`.
288+
/// Returns the total number of whole microseconds contained by this `Duration`.
289289
///
290290
/// # Examples
291291
///

0 commit comments

Comments
 (0)