package timere

  1. Overview
  2. Docs
type sign = [
  1. | `Pos
  2. | `Neg
]
type t = private {
  1. sign : sign;
  2. days : int;
  3. hours : int;
  4. minutes : int;
  5. seconds : int;
  6. ns : int;
}

Signed/directional duration.

Human friendly, but less efficient version of Span.t.

Conversion between t and Span.t is lossless.

val make : ?sign:sign -> ?days:int -> ?hours:int -> ?minutes:int -> ?seconds:int -> ?ns:int -> unit -> t

sign defaults to `Pos.

  • raises Invalid_argument

    if any of the arguments are negative

val make_frac : ?sign:sign -> ?days:float -> ?hours:float -> ?minutes:float -> ?seconds:float -> ?ns:int -> unit -> t

sign defaults to `Pos.

  • raises Invalid_argument

    if any of the arguments are negative

val zero : t
val is_pos : t -> bool
val is_neg : t -> bool
val equal : t -> t -> bool
val of_span : Span.t -> t
val to_span : t -> Span.t
val to_string : t -> string
val pp : Stdlib.Format.formatter -> t -> unit
val to_sexp : t -> CCSexp.t
val to_sexp_string : t -> string
val of_sexp : CCSexp.t -> (t, string) Stdlib.result
val of_sexp_string : string -> (t, string) Stdlib.result
val pp_sexp : Stdlib.Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.