package caldav
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=47e8daa3246d42bab21696d7a81a8b2e5cf68551f64be440778d4ea70c4ec04a
sha512=881692617a96640dbaeff056bccd3ef57aa06baaae2cd2faaaf7adf76b0c0bcd0a573ab348185064e1a40cf8bc44660c4f0891d9e259b48ccb55847774890854
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