Module Mtime.Span

module Span: sig .. end
Monotonic time spans.


Monotonic time spans


type t = Mtime.span 
See Mtime.span.
val to_uint64_ns : Mtime.span -> int64
to_uint64_ns span is span as an unsigned 64-bit integer nanosecond span.
val of_uint64_ns : int64 -> Mtime.span
of_uint64_ns d is the unsigned 64-bit integer nanosecond span as a span.

Constants


val zero : Mtime.span
zero is a span of 0ns.
val one : Mtime.span
one is a span of 1ns.
val min_span : Mtime.span
min_span is Mtime.Span.zero.
val max_span : Mtime.span
max_span is 2^64-1ns.

Predicates


val equal : Mtime.span -> Mtime.span -> bool
equal span span' is true iff span and span' are equal.
val compare : Mtime.span -> Mtime.span -> int
compare span span' orders spans by increasing duration.

Arithmetic


val add : Mtime.span -> Mtime.span -> Mtime.span
add span span' is span + span'.

Warning. Rolls over on overflow.

val abs_diff : Mtime.span -> Mtime.span -> Mtime.span
abs_diff span span' is the absolute difference between span and span'.

Converting time spans

See this section for time scale definitions.

val to_ns : Mtime.span -> float
to_ns span is span in nanoseconds (1e-9s).
val to_us : Mtime.span -> float
to_us span is span in microseconds (1e-6s).
val to_ms : Mtime.span -> float
to_ms span is span in milliseconds (1e-3s).
val to_s : Mtime.span -> float
to_s span is span is seconds.
val to_min : Mtime.span -> float
to_min span is span in SI-accepted minutes (60s).
val to_hour : Mtime.span -> float
to_hour span is span in SI-accepted hours (3600s).
val to_day : Mtime.span -> float
to_day span is span in SI-accepted days (24 hours, 86400s).
val to_year : Mtime.span -> float
to_year span is span in Julian years (365.25 days, 31'557'600s).

Pretty printing


val pp : Format.formatter -> Mtime.span -> unit
pp_span ppf span prints an unspecified representation of span on ppf. The representation is not fixed-width, depends on the magnitude of span and uses locale independent standard time scale abbreviations.
val pp_float_s : Format.formatter -> float -> unit
pp_float_s prints like Mtime.Span.pp does but on a floating point seconds time span value (which can be negative).
val dump : Format.formatter -> t -> unit
dump ppf span prints an unspecified raw representation of span on ppf.