diff options
author | Maxime Dénès <mail@maximedenes.fr> | 2017-07-21 15:22:28 +0200 |
---|---|---|
committer | Maxime Dénès <mail@maximedenes.fr> | 2017-07-21 15:22:28 +0200 |
commit | 5b3d0f2cd7a5f480fe24a938e2f6713798c7139a (patch) | |
tree | 583fe455007af9d6c5ab1cf4479eacb93ba9a08b /lib/control.ml | |
parent | a6f5bd2bdc01eeebf1617dd3b0c6823f4aac438c (diff) |
PMP sold us a Timeout on Windows with 1s resolution. Trying to improve it.
Diffstat (limited to 'lib/control.ml')
-rw-r--r-- | lib/control.ml | 6 |
1 files changed, 3 insertions, 3 deletions
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 |