mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
doc
This commit is contained in:
parent
696a5d4b91
commit
610244aad4
1 changed files with 5 additions and 1 deletions
|
|
@ -21,6 +21,7 @@ end
|
||||||
(** Clock that uses ptime. *)
|
(** Clock that uses ptime. *)
|
||||||
let ptime_clock : t = { now = now_ptime_ }
|
let ptime_clock : t = { now = now_ptime_ }
|
||||||
|
|
||||||
|
(** Singleton clock *)
|
||||||
module Main = struct
|
module Main = struct
|
||||||
open struct
|
open struct
|
||||||
let main : t Atomic.t = Atomic.make ptime_clock
|
let main : t Atomic.t = Atomic.make ptime_clock
|
||||||
|
|
@ -28,9 +29,12 @@ module Main = struct
|
||||||
|
|
||||||
let[@inline] get () = Atomic.get main
|
let[@inline] get () = Atomic.get main
|
||||||
|
|
||||||
|
(** Set the current clock *)
|
||||||
let set t : unit = Util_atomic.update_cas main (fun _ -> (), t)
|
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 ())) }
|
let dynamic_main : t = { now = (fun () -> now (get ())) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue