Skip to content

Commit

Permalink
Disable the 80-year-difference test on 32-bit-time_t platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytm committed Sep 7, 2017
1 parent 7560265 commit 83d14bd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/libstd/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 83d14bd

Please sign in to comment.