diff options
| author | bors <bors@rust-lang.org> | 2019-03-26 17:25:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-03-26 17:25:16 +0000 |
| commit | fbd34efb32b9efb574899e4335bdc8c6525ac27e (patch) | |
| tree | 53ca160f6c731c05e092002bae40e03b22dae376 /src/libstd/sys/windows | |
| parent | 07d350897c7f95bb40ae9762ad1e945f95fc37ae (diff) | |
| parent | 822b4fcb3bb583240c47158ee91d8ed6ae805e45 (diff) | |
| download | rust-fbd34efb32b9efb574899e4335bdc8c6525ac27e.tar.gz rust-fbd34efb32b9efb574899e4335bdc8c6525ac27e.zip | |
Auto merge of #59433 - Centril:rollup, r=Centril
Rollup of 10 pull requests
Successful merges:
- #59150 (Expand suggestions for type ascription parse errors)
- #59232 (Merge `Promoted` and `Static` in `mir::Place`)
- #59267 (Provide suggestion when using field access instead of path)
- #59315 (Add no_hash to query macro and move some queries over)
- #59334 (Update build instructions in README.md)
- #59362 (Demo `FromIterator` short-circuiting)
- #59374 (Simplify checked_duration_since)
- #59389 (replace redundant note in deprecation warning)
- #59410 (Clarify `{Ord,f32,f64}::clamp` docs a little)
- #59419 (Utilize `?` instead of `return None`.)
Failed merges:
r? @ghost
Diffstat (limited to 'src/libstd/sys/windows')
| -rw-r--r-- | src/libstd/sys/windows/time.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sys/windows/time.rs b/src/libstd/sys/windows/time.rs index 2c99bca7009..aa53f1194fd 100644 --- a/src/libstd/sys/windows/time.rs +++ b/src/libstd/sys/windows/time.rs @@ -49,17 +49,17 @@ impl Instant { Instant { t: Duration::from_secs(0) } } - pub fn sub_instant(&self, other: &Instant) -> Duration { + pub fn checked_sub_instant(&self, other: &Instant) -> Option<Duration> { // On windows there's a threshold below which we consider two timestamps // equivalent due to measurement error. For more details + doc link, // check the docs on epsilon. let epsilon = perf_counter::PerformanceCounterInstant::epsilon(); if other.t > self.t && other.t - self.t <= epsilon { - return Duration::new(0, 0) + Some(Duration::new(0, 0)) + } else { + self.t.checked_sub(other.t) } - self.t.checked_sub(other.t) - .expect("specified instant was later than self") } pub fn checked_add_duration(&self, other: &Duration) -> Option<Instant> { |
