Skip to content

Commit 6f3becb

Browse files
committed
Auto merge of #30061 - tshepang:doc-time, r=brson
2 parents da0444d + cc815d2 commit 6f3becb

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

src/libstd/time/mod.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@ pub use self::duration::Duration;
2222

2323
mod duration;
2424

25-
/// A measurement of a monotonically increasing clock which is suitable for
26-
/// measuring the amount of time that an operation takes.
25+
/// A measurement of a monotonically increasing clock.
2726
///
28-
/// Instants are guaranteed always be greater than any previously measured
27+
/// Instants are always guaranteed to be greater than any previously measured
2928
/// instant when created, and are often useful for tasks such as measuring
3029
/// benchmarks or timing how long an operation takes.
3130
///
3231
/// Note, however, that instants are not guaranteed to be **steady**. In other
33-
/// words each tick of the underlying clock may not be the same length (e.g.
32+
/// words, each tick of the underlying clock may not be the same length (e.g.
3433
/// some seconds may be longer than others). An instant may jump forwards or
3534
/// experience time dilation (slow down or speed up), but it will never go
3635
/// backwards.
3736
///
3837
/// Instants are opaque types that can only be compared to one another. There is
39-
/// no method to get "the number of seconds" from an instant but instead it only
40-
/// allow learning the duration between two instants (or comparing two
38+
/// no method to get "the number of seconds" from an instant. Instead, it only
39+
/// allows measuring the duration between two instants (or comparing two
4140
/// instants).
4241
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
4342
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
@@ -60,7 +59,7 @@ pub struct Instant(time::Instant);
6059
/// Although a `SystemTime` cannot be directly inspected, the `UNIX_EPOCH`
6160
/// constant is provided in this module as an anchor in time to learn
6261
/// information about a `SystemTime`. By calculating the duration from this
63-
/// fixed point in time a `SystemTime` can be converted to a human-readable time
62+
/// fixed point in time, a `SystemTime` can be converted to a human-readable time,
6463
/// or perhaps some other string representation.
6564
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
6665
#[unstable(feature = "time2", reason = "recently added", issue = "29866")]
@@ -95,8 +94,9 @@ impl Instant {
9594
///
9695
/// # Panics
9796
///
98-
/// This function may panic if the current time is earlier than this instant
99-
/// which can happen if an `Instant` is produced synthetically.
97+
/// This function may panic if the current time is earlier than this
98+
/// instant, which is something that can happen if an `Instant` is
99+
/// produced synthetically.
100100
pub fn elapsed(&self) -> Duration {
101101
Instant::now().duration_from_earlier(*self)
102102
}
@@ -140,7 +140,7 @@ impl SystemTime {
140140
/// guaranteed to always be before later measurements (due to anomalies such
141141
/// as the system clock being adjusted either forwards or backwards).
142142
///
143-
/// If successful, `Ok(duration)` is returned where the duration represents
143+
/// If successful, `Ok(Duration)` is returned where the duration represents
144144
/// the amount of time elapsed from the specified measurement to this one.
145145
///
146146
/// Returns an `Err` if `earlier` is later than `self`, and the error
@@ -207,9 +207,8 @@ impl SystemTimeError {
207207
/// second system time was from the first.
208208
///
209209
/// A `SystemTimeError` is returned from the `duration_from_earlier`
210-
/// operation whenever the second duration, `earlier`, actually represents a
211-
/// point later in time than the `self` of the method call. This function
212-
/// will extract and return the amount of time later `earlier` actually is.
210+
/// operation whenever the second system time represents a point later
211+
/// in time than the `self` of the method call.
213212
pub fn duration(&self) -> Duration {
214213
self.0
215214
}

0 commit comments

Comments
 (0)