@@ -22,22 +22,21 @@ pub use self::duration::Duration;
22
22
23
23
mod duration;
24
24
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.
27
26
///
28
- /// Instants are guaranteed always be greater than any previously measured
27
+ /// Instants are always guaranteed to be greater than any previously measured
29
28
/// instant when created, and are often useful for tasks such as measuring
30
29
/// benchmarks or timing how long an operation takes.
31
30
///
32
31
/// 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.
34
33
/// some seconds may be longer than others). An instant may jump forwards or
35
34
/// experience time dilation (slow down or speed up), but it will never go
36
35
/// backwards.
37
36
///
38
37
/// 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
41
40
/// instants).
42
41
#[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
43
42
#[ unstable( feature = "time2" , reason = "recently added" , issue = "29866" ) ]
@@ -60,7 +59,7 @@ pub struct Instant(time::Instant);
60
59
/// Although a `SystemTime` cannot be directly inspected, the `UNIX_EPOCH`
61
60
/// constant is provided in this module as an anchor in time to learn
62
61
/// 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,
64
63
/// or perhaps some other string representation.
65
64
#[ derive( Copy , Clone , PartialEq , Eq , PartialOrd , Ord ) ]
66
65
#[ unstable( feature = "time2" , reason = "recently added" , issue = "29866" ) ]
@@ -95,8 +94,9 @@ impl Instant {
95
94
///
96
95
/// # Panics
97
96
///
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.
100
100
pub fn elapsed ( & self ) -> Duration {
101
101
Instant :: now ( ) . duration_from_earlier ( * self )
102
102
}
@@ -140,7 +140,7 @@ impl SystemTime {
140
140
/// guaranteed to always be before later measurements (due to anomalies such
141
141
/// as the system clock being adjusted either forwards or backwards).
142
142
///
143
- /// If successful, `Ok(duration )` is returned where the duration represents
143
+ /// If successful, `Ok(Duration )` is returned where the duration represents
144
144
/// the amount of time elapsed from the specified measurement to this one.
145
145
///
146
146
/// Returns an `Err` if `earlier` is later than `self`, and the error
@@ -207,9 +207,8 @@ impl SystemTimeError {
207
207
/// second system time was from the first.
208
208
///
209
209
/// 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.
213
212
pub fn duration ( & self ) -> Duration {
214
213
self . 0
215
214
}
0 commit comments