POSIX time clock.
Ptime_clock provides access to a system POSIX time clock and to
the system's current time zone offset.
This time does not increase monotically and is subject to system calendar time adjustments. Use Mtime if you need monotonic wall-clock time to measure time spans.
Consult important information about error handling and platform support.
v0.8.3 - homepage
val now : unit -> Ptime.t
now () is the current POSIX time, by definition always on the
val period : unit -> Ptime.span option
period () is a positive POSIX time span representing
the clock's period (if available).
val current_tz_offset_s : unit -> Ptime.tz_offset_s option
current_tz_offset_s () is the system's current local time zone
offset to UTC in seconds, if known. This is the duration local
time - UTC time in seconds.
val now_d_ps : unit -> int * int64
now_d_ps () is
(d, ps) representing POSIX time occuring at
d * 86'400e12 +
ps POSIX picoseconds from the epoch
1970-01-01 00:00:00 UTC.
ps is in the range
val period_d_ps : unit -> (int * int64) option
period_d_ps () is if available
Some (d, ps) representing the
clock's picosecond period
d * 86'400e12 +
ps is in the
The functions now and now_d_ps raise
they can't determine the current time or that it doesn't fit in
Ptime's well-defined range. This exception should
only be catched at the toplevel of your program to log it and
abort the program. It indicates a serious error condition in the
All the other functions, whose functionality is less essential,
simply silently return
None if they can't determine the
information either because it is unavailable or because an error