Skip to content

Commit 1d1213f

Browse files
alexcrichtonpietroalbini
authored andcommitted
Increase Duration approximate equal threshold to 1us
Previously this threshold when testing was 100ns, but the Windows documentation states: > which is a high resolution (<1us) time stamp which presumably means that we could have up to 1us resolution, which means that 100ns doesn't capture "equivalent" time intervals due to various bits of rounding here and there. It's hoped that this.. Closes rust-lang#56034
1 parent 4541827 commit 1d1213f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libstd/time.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,8 @@ mod tests {
481481
let (a, b) = ($a, $b);
482482
if a != b {
483483
let (a, b) = if a > b {(a, b)} else {(b, a)};
484-
assert!(a - Duration::new(0, 100) <= b);
484+
assert!(a - Duration::new(0, 1000) <= b,
485+
"{:?} is not almost equal to {:?}", a, b);
485486
}
486487
})
487488
}

0 commit comments

Comments
 (0)