Bonsai.ClockFunctions allowing for the creation of time-dependent computations in a testable way.
val approx_now :
here:lexing_position ->
tick_every:Core.Time_ns.Span.t ->
unit ->
Core.Time_ns.t Computation.tThe current time, updated at tick_every intervals.
module Before_or_after : sig ... endval at :
here:lexing_position ->
Core.Time_ns.t Value.t ->
Before_or_after.t Computation.tMirrors Incr.Clock.at, which changes from Before to After at the specified time.
val every :
here:lexing_position ->
when_to_start_next_effect:
[< `Wait_period_after_previous_effect_starts_blocking
| `Wait_period_after_previous_effect_finishes_blocking
| `Every_multiple_of_period_non_blocking
| `Every_multiple_of_period_blocking ] ->
?trigger_on_activate:bool ->
Core.Time_ns.Span.t Value.t ->
unit Effect.t Value.t ->
unit Computation.tAn event passed to [every] is scheduled on an interval determined by
the time-span argument.
[when_to_start_next_effect] has the following behavior
| `Wait_period_after_previous_effect_starts_blocking -> If the previous effect takes longer than [period], we wait until it finishes before starting the next effect.
| `Wait_period_after_previous_effect_finishes_blocking -> The effect will always be executed [period] after the previous effect finishes.
| `Every_multiple_of_period_non_blocking -> Executes the effect at a regular interval.
| `Every_multiple_of_period_blocking -> Same as `Every_multiple_of_second, but skips a beat if the previous effect is still running.val get_current_time :
here:lexing_position ->
unit ->
Core.Time_ns.t Effect.t Computation.tAn effect for fetching the current time.
val sleep :
here:lexing_position ->
unit ->
(Core.Time_ns.Span.t -> unit Effect.t) Computation.tThe function in this computation produces an effect that completes after the specified amount of time.
val until :
here:lexing_position ->
unit ->
(Core.Time_ns.t -> unit Effect.t) Computation.tLike sleep, but waits until a specific time, rather than a time relative to now.
module Expert : sig ... end