Module Luv__.Timer
type t
= [ `Timer ] Luv.Handle.t
Binds
uv_timer_t
.Note that values of this type can be passed to functions in
Luv.Handle
, in addition to the functions in this module. In particular, seeLuv.Handle.close
.
val init : ?loop:Luv.Loop.t -> unit -> (t, Luv.Error.t) Result.result
Allocates and initializes a timer.
Binds
uv_timer_init
.
val start : ?call_update_time:bool -> ?repeat:int -> t -> int -> (unit -> unit) -> (unit, Luv.Error.t) Result.result
Starts a timer.
Binds
uv_timer_start
.
val stop : t -> (unit, Luv.Error.t) Result.result
Stops a timer.
Binds
uv_timer_stop
.
val again : t -> (unit, Luv.Error.t) Result.result
Restarts a timer.
Binds
uv_timer_again
.
val set_repeat : t -> int -> unit
Sets the timer repeat interval.
Binds
uv_timer_set_repeat
.
val get_repeat : t -> int
Retrieves the timer repeat interval.
Binds
uv_timer_get_repeat
.
val get_due_in : t -> int
Evaluates to the time until the timer expires, or zero if it has already expired.
Binds
uv_timer_get_due_in
.Requires Luv 0.5.6 and libuv 1.40.0.
Feature check:
Luv.Require.(has timer_get_due_in)