diff options
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/time/monotonic.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/std/src/time/monotonic.rs b/library/std/src/time/monotonic.rs index 4f79b670a3a..d4572ee76be 100644 --- a/library/std/src/time/monotonic.rs +++ b/library/std/src/time/monotonic.rs @@ -34,14 +34,14 @@ pub mod inner { let packed = (secs << 32) | nanos; let old = MONO.load(Relaxed); - if packed == UNINITIALIZED || packed.wrapping_sub(old) < u64::MAX / 2 { + if old == UNINITIALIZED || packed.wrapping_sub(old) < u64::MAX / 2 { MONO.store(packed, Relaxed); raw } else { // Backslide occurred. We reconstruct monotonized time by assuming the clock will never // backslide more than 2`32 seconds which means we can reuse the upper 32bits from // the seconds. - let secs = (secs & 0xffff_ffff << 32) | old >> 32; + let secs = (secs & 0xffff_ffff_0000_0000) | old >> 32; let nanos = old as u32; ZERO.checked_add_duration(&Duration::new(secs, nanos)).unwrap() } |
