From 83d14bda7fe87b37b61904417cfb53f6351b5f3a Mon Sep 17 00:00:00 2001 From: kennytm Date: Thu, 7 Sep 2017 13:09:18 +0800 Subject: [PATCH] Disable the 80-year-difference test on 32-bit-time_t platforms. --- src/libstd/time/mod.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/libstd/time/mod.rs b/src/libstd/time/mod.rs index 291def3e64661..d4993ded843dd 100644 --- a/src/libstd/time/mod.rs +++ b/src/libstd/time/mod.rs @@ -520,9 +520,12 @@ mod tests { assert_almost_eq!(a - second + second, a); - let eighty_years = second * 60 * 60 * 24 * 365 * 80; - assert_almost_eq!(a - eighty_years + eighty_years, a); - assert_almost_eq!(a - (eighty_years * 10) + (eighty_years * 10), a); + // A difference of 80 and 800 years cannot fit inside a 32-bit time_t + if !(cfg!(unix) && ::mem::size_of::<::libc::time_t>() <= 4) { + let eighty_years = second * 60 * 60 * 24 * 365 * 80; + assert_almost_eq!(a - eighty_years + eighty_years, a); + assert_almost_eq!(a - (eighty_years * 10) + (eighty_years * 10), a); + } let one_second_from_epoch = UNIX_EPOCH + Duration::new(1, 0); let one_second_from_epoch2 = UNIX_EPOCH + Duration::new(0, 500_000_000)