Fix the time overflow on mac as well
This commit is contained in:
parent
5dbc373f70
commit
07471423a2
1 changed files with 1 additions and 1 deletions
|
@ -111,7 +111,7 @@ mod inner {
|
||||||
// Nano calculations can't overflow because nanos are <1B which fit
|
// Nano calculations can't overflow because nanos are <1B which fit
|
||||||
// in a u32.
|
// in a u32.
|
||||||
let mut usec = (other.subsec_nanos() / 1000) + self.t.tv_usec as u32;
|
let mut usec = (other.subsec_nanos() / 1000) + self.t.tv_usec as u32;
|
||||||
if usec > USEC_PER_SEC as u32 {
|
if usec >= USEC_PER_SEC as u32 {
|
||||||
usec -= USEC_PER_SEC as u32;
|
usec -= USEC_PER_SEC as u32;
|
||||||
secs = secs.checked_add(1).expect("overflow when adding \
|
secs = secs.checked_add(1).expect("overflow when adding \
|
||||||
duration to time");
|
duration to time");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue