include Core_kernel__.Span_intf.Span with type underlying = floatinclude Core_kernel__.Span_intf.Stype underlyingSpan.t represents a span of time (e.g. 7 minutes, 3 hours, 12.8 days). The span may be positive or negative.
include sig ... endval bin_t : t Bin_prot.Type_class.tval bin_read_t : t Bin_prot.Read.readerval __bin_read_t__ : (Core_kernel__.Import.int ‑> t) Bin_prot.Read.readerval bin_reader_t : t Bin_prot.Type_class.readerval bin_size_t : t Bin_prot.Size.sizerval bin_write_t : t Bin_prot.Write.writerval bin_writer_t : t Bin_prot.Type_class.writerval bin_shape_t : Bin_prot.Shape.tval hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.stateval hash : t ‑> Base.Hash.hash_valueval t_of_sexp : Base.Sexp.t ‑> tval sexp_of_t : t ‑> Base.Sexp.tmodule Parts : Core_kernel__.Span_intf.Partsinclude Core_kernel__.Std_internal.Comparable_binable with type t := tinclude Core_kernel__.Comparable_intf.S_commoninclude Base.Comparable.Sinclude Base__.Comparable_intf.Polymorphic_compareascending is identical to compare. descending x y = ascending y x. These are
intended to be mnemonic when used like List.sort ~compare:ascending and List.sort
~cmp:descending, since they cause the list to be sorted in ascending or descending
order, respectively.
clamp_exn t ~min ~max returns t', the closest value to t such that
between t' ~low:min ~high:max is true.
Raises if not (min <= max).
val clamp : t ‑> min:t ‑> max:t ‑> t Base.Or_error.tinclude Base.Comparator.S with type t := tval comparator : (t, comparator_witness) Base.Comparator.comparatorinclude Base__.Comparable_intf.Validate with type t := tval validate_lbound : min:t Base.Maybe_bound.t ‑> t Base.Validate.checkval validate_ubound : max:t Base.Maybe_bound.t ‑> t Base.Validate.checkval validate_bound : min:t Base.Maybe_bound.t ‑> max:t Base.Maybe_bound.t ‑> t Base.Validate.checkmodule Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := tinclude Core_kernel__.Comparable_intf.Map_and_set_binable with type t := t with type comparator_witness := comparator_witnessinclude Core_kernel.Comparator.S with type t := tval comparator : (t, comparator_witness) Core_kernel.Comparator.comparatormodule Map : Core_kernel.Map.S_binable with type Key.t = t with type Key.comparator_witness = comparator_witnessmodule Set : Core_kernel.Set.S_binable with type Elt.t = t with type Elt.comparator_witness = comparator_witnessinclude Core_kernel.Comparable.With_zero with type t := tval validate_positive : t Base.Validate.checkval validate_non_negative : t Base.Validate.checkval validate_negative : t Base.Validate.checkval validate_non_positive : t Base.Validate.checkval is_positive : t ‑> boolval is_non_negative : t ‑> boolval is_negative : t ‑> boolval is_non_positive : t ‑> boolval sign : t ‑> Base__.Sign0.tReturns Neg, Zero, or Pos in a way consistent with the above functions.
include Core_kernel__.Std_internal.Hashable_binable with type t := tinclude sig ... endval hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.stateval hash : t ‑> Base.Hash.hash_valueval hashable : t Core_kernel.Hashtbl.Hashable.tmodule Table : Core_kernel.Hashtbl.S_binable with type key = tmodule Hash_set : Core_kernel.Hash_set.S_binable with type elt = tmodule Hash_queue : Core_kernel.Hash_queue.S with type Key.t = tinclude Core_kernel__.Import.Pretty_printer.S with type t := tval pp : Base.Formatter.t ‑> t ‑> unitval to_string : t ‑> Core_kernel__.Import.stringString converters and sexp converters allow for specifying of time spans in various units after a leading float (e.g. 45s, 3h, or 1d):
ms - milliseconds s - seconds m - minutes h - hours d - days
The outgoing conversion functions use these units as well, choosing the largest available type. For instance, if it's a bit greater than or equal to 1 hour, the span will be rendered in hours, (Time.to_string (Time.of_string "66m") = "1.1h").
As of Stable.V2, of_string and t_of_sexp also accept "us"=microseconds and
"ns"=nanoseconds suffixes. Stable.V2 will produce these suffixes, but for
compatibility with Stable.V1, ordinary to_string and sexp_of_t will not, for now.
Once use of the new of_ family is more widespread, we will switch the to_ family to
the more expressive format. In the meantime, you can get ns and us suffixes by
using to_string_hum.
val of_string : Core_kernel__.Import.string ‑> tval nanosecond : tval microsecond : tval millisecond : tval second : tval minute : tval hour : tval day : tval robust_comparison_tolerance : t10^-6 seconds, used in robustly comparable operators (<., >., =., ...) to determine equality
val zero : tval create : ?sign:Core_kernel.Sign.t ‑> ?day:Core_kernel__.Import.int ‑> ?hr:Core_kernel__.Import.int ‑> ?min:Core_kernel__.Import.int ‑> ?sec:Core_kernel__.Import.int ‑> ?ms:Core_kernel__.Import.int ‑> ?us:Core_kernel__.Import.int ‑> ?ns:Core_kernel__.Import.int ‑> Core_kernel__.Import.unit ‑> tcreate ?sign ?day ?hr ?min ?sec ?ms ?us ?ns () Create a span from the given parts.
All parts are assumed to be positive (no checking is done by the function) and the
sign of the final span is given by sign which is positive by default.
val of_ns : Core_kernel__.Import.float ‑> tval of_us : Core_kernel__.Import.float ‑> tval of_ms : Core_kernel__.Import.float ‑> tval of_sec : Core_kernel__.Import.float ‑> tval of_int_sec : Core_kernel__.Import.int ‑> tval of_int32_seconds : Core_kernel.Int32.t ‑> tval of_int63_seconds : Core_kernel.Int63.t ‑> tval of_min : Core_kernel__.Import.float ‑> tval of_hr : Core_kernel__.Import.float ‑> tval of_day : Core_kernel__.Import.float ‑> tval to_ns : t ‑> Core_kernel__.Import.floatval to_us : t ‑> Core_kernel__.Import.floatval to_ms : t ‑> Core_kernel__.Import.floatval to_sec : t ‑> Core_kernel__.Import.floatval to_min : t ‑> Core_kernel__.Import.floatval to_hr : t ‑> Core_kernel__.Import.floatval to_day : t ‑> Core_kernel__.Import.floatval to_int63_seconds_round_down_exn : t ‑> Core_kernel.Int63.tto_int63_seconds_round_down_exn t returns the number of seconds represented by
t, rounded down, raising if the result is not representable as an Int63.t.
val to_proportional_float : t ‑> Core_kernel__.Import.floatThe 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 scale : t ‑> Core_kernel__.Import.float ‑> tval (/) : t ‑> Core_kernel__.Import.float ‑> tval (//) : t ‑> t ‑> Core_kernel__.Import.floatval to_short_string : t ‑> Core_kernel__.Import.stringto_short_string t pretty-prints approximate time span using no more than
five characters if the span is positive, and six if the span is negative.
Examples
"4h" = 4 hours"5m" = 5 minutes"4s" = 4 seconds"10ms" = 10 millisecondsonly the most significant denomination is shown.
val to_unit_of_time : t ‑> Core_kernel.Unit_of_time.tto_unit_of_time t = Day if abs t >= day, Hour if abs t >= hour, and so on
down to Microsecond if abs t >= microsecond, and Nanosecond otherwise.
val of_unit_of_time : Core_kernel.Unit_of_time.t ‑> tof_unit_of_time unit_of_time produces a t representing the corresponding span.
val to_string_hum : ?delimiter:Core_kernel__.Import.char ‑> ?decimals:Core_kernel__.Import.int ‑> ?align_decimal:Core_kernel__.Import.bool ‑> ?unit_of_time:Core_kernel.Unit_of_time.t ‑> t ‑> Core_kernel__.Import.stringto_string_hum t ~delimiter ~decimals ~align_decimal ~unit_of_time formats t using
the given unit of time, or the largest appropriate units if none is specified, among
"d"=day, "h"=hour, "m"=minute, "s"=second, "ms"=millisecond, "us"=microsecond, or
"ns"=nanosecond. The magnitude of the time span in the chosen unit is formatted by:
Float.to_string_hum ~delimiter ~decimals ~strip_zero:(not align_decimal)
If align_decimal is true, the single-character suffixes are padded with an extra
space character. In combination with not stripping zeroes, this means that the
decimal point will occur a fixed number of characters from the end of the string.
val randomize : t ‑> percent:Core_kernel.Percent.t ‑> trandomize t ~percent returns a span +/- percent * original span. Percent must be
between 0% and 100% inclusive, and must be positive.
module Stable : Core_kernel__.Span_intf.S_stable with type t := t