We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a98a309 commit 7256a6aCopy full SHA for 7256a6a
library/std/src/time/monotonic.rs
@@ -34,14 +34,14 @@ pub mod inner {
34
let packed = (secs << 32) | nanos;
35
let old = MONO.load(Relaxed);
36
37
- if packed == UNINITIALIZED || packed.wrapping_sub(old) < u64::MAX / 2 {
+ if old == UNINITIALIZED || packed.wrapping_sub(old) < u64::MAX / 2 {
38
MONO.store(packed, Relaxed);
39
raw
40
} else {
41
// Backslide occurred. We reconstruct monotonized time by assuming the clock will never
42
// backslide more than 2`32 seconds which means we can reuse the upper 32bits from
43
// the seconds.
44
- let secs = (secs & 0xffff_ffff << 32) | old >> 32;
+ let secs = (secs & 0xffff_ffff_0000_0000) | old >> 32;
45
let nanos = old as u32;
46
ZERO.checked_add_duration(&Duration::new(secs, nanos)).unwrap()
47
}
0 commit comments