module Span:sig
..end
typet =
Core_kernel.Time_ns.Span.t
val typerep_of_t : t Typerep_lib.Std.Typerep.t
val typename_of_t : t Typerep_lib.Std.Typename.t
include Identifiable
module Parts:sig
..end
Time.Span.Parts
, but adding ns
.
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_int_sec : int -> t
val to_int_sec : t -> int
val zero : t
val min_value : t
val max_value : t
val (+) : t -> t -> t
val (-) : t -> t -> t
val abs : t -> t
val neg : t -> t
val scale : t -> float -> t
val scale_int : t -> int -> t
val div : t -> t -> Core_kernel.Std.Int63.t
val (/) : t -> float -> t
val (//) : t -> t -> float
val create : ?sign:Core_kernel.Std.Float.Sign.t ->
?day:int ->
?hr:int ->
?min:int ->
?sec:int -> ?ms:int -> ?us:int -> ?ns:int -> unit -> t
val to_short_string : t -> string
val randomize : t -> percent:float -> t
val to_parts : t -> Parts.t
val of_parts : Parts.t -> t
val to_span : t -> Time.Span.t
Time.t
is precise to approximately 0.24us in 2014. If to_span
converts to the
closest Time.Span.t
, we have stability problems: converting back yields a
different t
, sometimes different enough to have a different external
representation, because the conversion back and forth crosses a rounding boundary.
To stabilize conversion, we treat Time.t
as having 1us precision: to_span
and
of_span
both round to the nearest 1us.
Around 135y magnitudes, Time.Span.t
no longer has 1us resolution. At that point,
to_span
and of_span
raise.
The concern with stability is in part due to an earlier incarnation of
Timing_wheel
that had surprising behavior due to rounding of floating-point times.
Timing_wheel was since re-implemented to use integer Time_ns
, and to treat
floating-point Time
s as equivalence classes according to the Time_ns
that they
round to. See Timing_wheel_float
for details.
val of_span : Time.Span.t -> t
include Robustly_comparable
val to_int63_ns : t -> Core_kernel.Std.Int63.t
val of_int63_ns : Core_kernel.Std.Int63.t -> t
val to_int_ns : t -> int
Time_ns.now
.
Consider to_int63_ns
instead.val of_int_ns : int -> t
module Stable:sig
..end
val random : unit -> t
module Option:sig
..end
with type span := t