Up

Module Span

Signature

type t = private Core_int63.t

t is immediate on 64bit boxes and so plays nicely with the GC write barrier. Unfortunately, private Core_int63.t is necessary for the compiler to optimize uses.

val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_writer_t : t Bin_prot.Type_class.writer
val typerep_of_t : t Typerep_lib.Std.Typerep.t
val typename_of_t : t Typerep_lib.Std.Typename.t
val compare : t -> t -> int
include Comparable.Infix with type t := t
type t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
include Comparable.Validate with type t := t
type t
val validate_lbound : min:t Maybe_bound.t -> t Validate.check
val validate_ubound : max:t Maybe_bound.t -> t Validate.check
val validate_bound : min:t Maybe_bound.t -> max:t Maybe_bound.t -> t Validate.check
include Comparable.With_zero with type t := t
type t
val validate_positive : t Validate.check
val validate_non_negative : t Validate.check
val validate_negative : t Validate.check
val validate_non_positive : t Validate.check
val is_positive : t -> bool
val is_non_negative : t -> bool
val is_negative : t -> bool
val is_non_positive : t -> bool
val sign : t -> Sign0.t

Returns Neg, Zero, or Pos in a way consistent with the above functions.

include Equal.S with type t := t
type t
val equal : t Equal.equal
val nanosecond : t
val microsecond : t
val millisecond : t
val second : t
val minute : t
val hour : t
val day : t
val of_ns : float -> t
val of_us : float -> t
val of_ms : float -> t
val of_sec : float -> t
val of_min : float -> t
val of_hr : float -> t
val of_day : float -> t
val to_ns : t -> float
val to_us : t -> float
val to_ms : t -> float
val to_sec : t -> float
val to_min : t -> float
val to_hr : t -> float
val to_day : t -> float
val of_sec_with_microsecond_precision : float -> t
val of_int_us : int -> t
val of_int_ms : int -> t
val of_int_sec : int -> t
val to_int_us : t -> int
val to_int_ms : t -> int
val to_int_sec : t -> int
val zero : t
val min_value : t

The limits of t are chosen to allow conversion to and from float spans with microsecond precision. This property supports Core.Std.Timing_wheel_float in particular. See also Core.Std.Time.

val max_value : t
val (+) : t -> t -> t

overflows silently

val (-) : t -> t -> t

overflows silently

overflows silently

val abs : t -> t

overflows silently

overflows silently on min_value

val neg : t -> t

overflows silently on min_value

overflows silently on min_value

val max : t -> t -> t

overflows silently on min_value

val scale : t -> float -> t
val scale_int : t -> int -> t

overflows silently

val scale_int63 : t -> Core_int63.t -> t

overflows silently

overflows silently

val div : t -> t -> Core_int63.t
val (/) : t -> float -> t
val (//) : t -> t -> float
val create : ?sign:Sign.t -> ?day:int -> ?hr:int -> ?min:int -> ?sec:int -> ?ms:int -> ?us:int -> ?ns:int -> unit -> t

Overflows silently.

module Parts : sig .. end
Similar to Time.Span.Parts, but adding ns.
val to_parts : t -> Parts.t
val of_parts : Parts.t -> t

overflows silently

include Std_internal.Robustly_comparable with type t := t
type t
val (>=.) : t -> t -> bool
val (<=.) : t -> t -> bool
val (=.) : t -> t -> bool
val (>.) : t -> t -> bool
val (<.) : t -> t -> bool
val (<>.) : t -> t -> bool
val robustly_compare : t -> t -> int
val to_int63_ns : t -> Core_int63.t

Fast, implemented as the identity function.

Fast, implemented as the identity function.

val of_int63_ns : Core_int63.t -> t

Fast, implemented as the identity function.

val to_int_ns : t -> int

Will raise on 32-bit platforms. Consider to_int63_ns instead.

val of_int_ns : int -> t
val since_unix_epoch : unit -> t
module Alternate_sexp : sig .. end
Note that we expose a sexp format that is not the one exposed in Core.