diff --git a/src/core/clock.ml b/src/core/clock.ml index 473af440..4a39145c 100644 --- a/src/core/clock.ml +++ b/src/core/clock.ml @@ -21,6 +21,7 @@ end (** Clock that uses ptime. *) let ptime_clock : t = { now = now_ptime_ } +(** Singleton clock *) module Main = struct open struct let main : t Atomic.t = Atomic.make ptime_clock @@ -28,9 +29,12 @@ module Main = struct let[@inline] get () = Atomic.get main + (** Set the current clock *) let set t : unit = Util_atomic.update_cas main (fun _ -> (), t) - (** Clock that always defers to the current main clock *) + (** Clock that always defers to the current main clock. Whenever + [now dynamic_main] is called, it in turn becomes [now (get ())], ie it + looks up the current clock and uses it. *) let dynamic_main : t = { now = (fun () -> now (get ())) } end