From 5b3d0f2cd7a5f480fe24a938e2f6713798c7139a Mon Sep 17 00:00:00 2001 From: Maxime Dénès Date: Fri, 21 Jul 2017 15:22:28 +0200 Subject: PMP sold us a Timeout on Windows with 1s resolution. Trying to improve it. --- lib/control.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/control.ml') diff --git a/lib/control.ml b/lib/control.ml index d9b91be3a..f5d7df204 100644 --- a/lib/control.ml +++ b/lib/control.ml @@ -48,7 +48,7 @@ let windows_timeout n f e = let exited = ref false in let thread init = while not !killed do - let cur = Unix.time () in + let cur = Unix.gettimeofday () in if float_of_int n <= cur -. init then begin interrupt := true; exited := true; @@ -57,12 +57,12 @@ let windows_timeout n f e = Thread.delay 0.5 done in - let init = Unix.time () in + let init = Unix.gettimeofday () in let _id = Thread.create thread init in try let res = f () in let () = killed := true in - let cur = Unix.time () in + let cur = Unix.gettimeofday () in (** The thread did not interrupt, but the computation took longer than expected. *) let () = if float_of_int n <= cur -. init then begin -- cgit v1.2.3