package eio

  1. Overview
  2. Docs

Clocks, time, sleeping and timeouts.

class virtual 'a clock_base : object ... end
class virtual clock : object ... end
val now : clock -> float

now t is the current time according to t.

val sleep_until : clock -> float -> unit

sleep_until t time waits until the given time is reached.

val sleep : clock -> float -> unit

sleep t d waits for d seconds.

module Mono : sig ... end

Monotonic clocks.

Timeouts

exception Timeout
val with_timeout : clock -> float -> (unit -> ('a, 'e) result) -> ('a, [> `Timeout ] as 'e) result

with_timeout clock d fn runs fn () but cancels it after d seconds.

val with_timeout_exn : clock -> float -> (unit -> 'a) -> 'a

with_timeout_exn clock d fn runs fn () but cancels it after d seconds, raising exception Timeout.

module Timeout : sig ... end

Timeout values.

OCaml

Innovation. Community. Security.