Skip to content

Commit 0747142

Browse files
committed
Fix the time overflow on mac as well
1 parent 5dbc373 commit 0747142

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/sys/unix/time.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ mod inner {
111111
// Nano calculations can't overflow because nanos are <1B which fit
112112
// in a u32.
113113
let mut usec = (other.subsec_nanos() / 1000) + self.t.tv_usec as u32;
114-
if usec > USEC_PER_SEC as u32 {
114+
if usec >= USEC_PER_SEC as u32 {
115115
usec -= USEC_PER_SEC as u32;
116116
secs = secs.checked_add(1).expect("overflow when adding \
117117
duration to time");

0 commit comments

Comments
 (0)