package caldav
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=2213432f79494809a8ea5c7726a0a264ab6770c7be74a929c65c39a27339e0a1
sha512=9c7ce48fbafa75ea309fcd49a5792976911bea857c9a3a4b334b9b75b3f65199669bacdfe62b98e34a7b5160883fd5b98d7795fd03aefad6434fa99545e26425
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