diff --git a/ocaml/libs/clock/test_timer.ml b/ocaml/libs/clock/test_timer.ml index 3729826cfa3..b94a3c470d2 100644 --- a/ocaml/libs/clock/test_timer.ml +++ b/ocaml/libs/clock/test_timer.ml @@ -25,6 +25,12 @@ let test_timer_remaining = (not (Timer.span_is_shorter Mtime.Span.(2 * actual) ~than:duration)) ; let () = match Timer.remaining timer with + | Expired _ when half < 0.05 -> + (* OS timer may not be accurate for very short sleeps, + or the system might be busy. + Skip the strict test on very short durations, we'll still test this on the 100ms+ ones. + *) + () | Expired t -> Test.fail_reportf "Expected to have spare time, but got excess: %a. Duration: %a, \