module type WATCHER =sig
..end
WATCHER
provides a base signature for watching nanosecond
precision clock ticks.
typespan_ns =
int64
type
trigger
type
t
val watch : delay_ns:span_ns -> trigger -> t
watch d tr
is a tick in that occurs after d
nanoseconds and is
watched by trigger tr
.val unwatch : t -> unit
unwatch w
unwatches the tick in w
. If w
is no longer
Tick.WATCHER.waiting
this has no effect. Otherwise w
's trigger is guaranteed
not to be actuated and Tick.WATCHER.waiting
w
becomes false
.val waiting : t -> bool
val linger_ns : t -> span_ns
linger_ns w
is the number of nanoseconds during which Tick.WATCHER.waiting
w
was true
. If w
's trigger was actuated then:
linger_ns w < delay_ns w
the tick was in advance.linger_ns w = delay_ns w
the tick was on time.linger_ns w > delay_ns w
the tick was late.val delay_ns : t -> span_ns
delay_ns w
is w
's waiting delay.val trigger : t -> trigger
trigger w
is w
's trigger.val fold : ('a -> t -> 'a) -> 'a -> 'a