package timere

  1. Overview
  2. Docs

Module Timere.SpanSource

Sourcetype t = private {
  1. s : int64;
  2. ns : int;
}

Signed/directional span of time expressed as a tuple of (s, ns)

  • s is the signed second of the span
  • ns is the unsigned nanosecond offset

The actual span represented is defined as s * 10^9 + ns in nanosecond, regardless of the sign of s

Order is defined using lexicographic order, i.e. lt x y iff. x.s < y.s || (x.s = y.s && x.ns < y.ns)

Sourceval ns_count_in_s : int
Sourceval ns_count_in_s_float : float
Sourceval zero : t
Sourceval make : ?s:int64 -> ?ns:int -> unit -> t

s defaults to 0L, ns defaults to 0

ns may be negative, and is normalized during construction

Interpretation of provided input is still s + ns, i.e. if you wish to represent "negative (1 second and 500 nanosecond)", then the call could look like make ~s:(-1L) ~ns:(-500)

Sourceval make_small : ?s:int -> ?ns:int -> unit -> t

Wrapper around make

Sourceval add : t -> t -> t
Sourceval sub : t -> t -> t
Sourceval succ : t -> t
Sourceval pred : t -> t
Sourceval neg : t -> t
Sourceval abs : t -> t
Sourceval equal : t -> t -> bool
Sourceval lt : t -> t -> bool
Sourceval le : t -> t -> bool
Sourceval gt : t -> t -> bool
Sourceval ge : t -> t -> bool
Sourceval compare : t -> t -> int
Sourceval to_float : t -> float
Sourceval of_float : float -> t
Sourceval max : t -> t -> t
Sourceval min : t -> t -> t
Sourceval (<) : t -> t -> bool
Sourceval (<=) : t -> t -> bool
Sourceval (>) : t -> t -> bool
Sourceval (>=) : t -> t -> bool
Sourceval (=) : t -> t -> bool
Sourceval (<>) : t -> t -> bool
Sourceval (-) : t -> t -> t
Sourceval (+) : t -> t -> t
Sourceval to_string : t -> string
Sourceval pp : Format.formatter -> t -> unit
Sourceval to_sexp : t -> CCSexp.t
Sourceval to_sexp_string : t -> string
Sourceval of_sexp : CCSexp.t -> (t, string) result
Sourceval of_sexp_string : string -> (t, string) result
Sourceval pp_sexp : Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.