package caldav
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=63a8818a537c443118e5ff710cc79059ce79c310744854c25ef77f25040f2724
sha512=52e28b504538b6acb7da8f41610f92cbc32716b951d9daa120025c1f2900fc56be21601c7b3b19c519171d2ee1cc4db316e1e0fdddad6a28e84999de35f6ac54
doc/caldav.webmachine/Webmachine/module-type-CLOCK/index.html
Module type Webmachine.CLOCK
Source
The CLOCK
module signature defines a clock source, that is used with the Webmachine.Make(IO)(Clock) functor.
Examples:
(* static mock time *) module MockClock = struct let now = fun () -> 1526322704 end
(* using Unix.gettimeofday *) module UnixClock = struct let now = fun () -> int_of_float (Unix.gettimeofday ()) end
(* using Ptime_clock, which uses the system POSIX clock/gettimeofday *) module PtimeClock = struct let now = fun () -> int_of_float (Ptime.to_float (Ptime_clock.now ())) end
(* using mirage-clock in MirageOS unikernels *) module MirageClock = struct let now = fun () -> let d, ps = Pclock.now_d_ps clock in let days_in_seconds = d * 86_400 in let picos_in_seconds = Int64.(to_int (div ps (1_000_000_000_000L))) i days_in_seconds + picos_in_seconds end