package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Time_ns.Span end
type t = private Int63.t

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

val hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
val hash : t -> Base.Hash.hash_value
val typerep_of_t : t Typerep_lib.Std.Typerep.t
val typename_of_t : t Typerep_lib.Std.Typename.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (Base.Int.t -> 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 bin_shape_t : Bin_prot.Shape.t
include Base.Comparisons.S with type t := t
include Base.Comparisons.Infix with type t := 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 equal : t -> t -> bool
val compare : t -> t -> int

compare t1 t2 returns 0 if t1 is equal to t2, a negative integer if t1 is less than t2, and a positive integer if t1 is greater than t2.

val min : t -> t -> t
val max : t -> t -> t
include Comparable.Validate with type t := t
val validate_lbound : min:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_ubound : max:t Base.Maybe_bound.t -> t Base.Validate.check
val validate_bound : min:t Base.Maybe_bound.t -> max:t Base.Maybe_bound.t -> t Base.Validate.check
include Comparable.With_zero with type t := t
val validate_positive : t Base.Validate.check
val validate_non_negative : t Base.Validate.check
val validate_negative : t Base.Validate.check
val validate_non_positive : t Base.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 -> Base__.Sign0.t

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

val nanosecond : t
val microsecond : t
val millisecond : t
val second : t
val minute : t
val hour : t
val day : t
val of_ns : Base.Float.t -> t
val of_us : Base.Float.t -> t
val of_ms : Base.Float.t -> t
val of_sec : Base.Float.t -> t
val of_min : Base.Float.t -> t
val of_hr : Base.Float.t -> t
val of_day : Base.Float.t -> t
val to_ns : t -> Base.Float.t
val to_us : t -> Base.Float.t
val to_ms : t -> Base.Float.t
val to_sec : t -> Base.Float.t
val to_min : t -> Base.Float.t
val to_hr : t -> Base.Float.t
val to_day : t -> Base.Float.t
val of_sec_with_microsecond_precision : Base.Float.t -> t
val of_int_us : Base.Int.t -> t
val of_int_ms : Base.Int.t -> t
val of_int_sec : Base.Int.t -> t
val to_int_us : t -> Base.Int.t
val to_int_ms : t -> Base.Int.t
val to_int_sec : t -> Base.Int.t
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.Timing_wheel_float in particular. See also Core.Time.

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

overflows silently

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

overflows silently

val abs : t -> t

overflows silently on min_value

val neg : t -> t

overflows silently on min_value

val scale : t -> Base.Float.t -> t
val scale_int : t -> Base.Int.t -> t

overflows silently

val scale_int63 : t -> Int63.t -> t

overflows silently

val div : t -> t -> Int63.t
val (/) : t -> Base.Float.t -> t
val (//) : t -> t -> Base.Float.t
val create : ?sign:Sign.t -> ?day:Base.Int.t -> ?hr:Base.Int.t -> ?min:Base.Int.t -> ?sec:Base.Int.t -> ?ms:Base.Int.t -> ?us:Base.Int.t -> ?ns:Base.Int.t -> Base.Unit.t -> t

Overflows silently.

module Parts = Time_ns.Span.Parts

Similar to Time.Span.Parts.

val to_parts : t -> Parts.t
val to_unit_of_time : t -> Unit_of_time.t
val of_unit_of_time : Unit_of_time.t -> t
include Interfaces.Robustly_comparable with type t := 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 -> Int63.t

Fast, implemented as the identity function.

val of_int63_ns : Int63.t -> t

Fast, implemented as the identity function.

val to_int_ns : t -> Base.Int.t

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

val of_int_ns : Base.Int.t -> t
val to_proportional_float : t -> Base.Float.t

The only condition to_proportional_float is supposed to satisfy is that for all t1, t2 : t: to_proportional_float t1 /. to_proportional_float t2 = t1 // t2.

val since_unix_epoch : Base.Unit.t -> t
val random : ?state:Base.Random.State.t -> Base.Unit.t -> t
module Alternate_sexp = Time_ns.Span.Alternate_sexp

Note that we expose a sexp format that is not the one exposed in Core.

include sig ... end
val t_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t