From 07471423a29bd4508a0552d4b9cfb104ca2a5928 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Fri, 4 Dec 2015 09:49:35 -0700 Subject: Fix the time overflow on mac as well --- src/libstd/sys/unix/time.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libstd') diff --git a/src/libstd/sys/unix/time.rs b/src/libstd/sys/unix/time.rs index cc026b8fd10..a07c30d9648 100644 --- a/src/libstd/sys/unix/time.rs +++ b/src/libstd/sys/unix/time.rs @@ -111,7 +111,7 @@ mod inner { // Nano calculations can't overflow because nanos are <1B which fit // in a 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; secs = secs.checked_add(1).expect("overflow when adding \ duration to time"); -- cgit 1.4.1-3-g733a5