type t = private underlying
include Bin_prot.Binable.S with type t := t
include Bin_prot.Binable.S_only_functions with type t := t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
This function only needs implementation if
t
exposed to be a polymorphic variant. Despite what the type reads, this does *not* produce a function after reading; instead it takes the constructor tag (int) before reading and reads the rest of the variantt
afterwards.
val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t
include Ppx_sexp_conv_lib.Sexpable.S with type t := t
val t_of_sexp : Sexplib0.Sexp.t -> t
val sexp_of_t : t -> Sexplib0.Sexp.t
include Typerep_lib.Typerepable.S with type t := t
val typerep_of_t : t Typerep_lib.Std_internal.Typerep.t
val typename_of_t : t Typerep_lib.Typename.t
include Base.Comparable.S with type t := t
val ascending : t -> t -> int
ascending
is identical tocompare
.descending x y = ascending y x
. These are intended to be mnemonic when used likeList.sort ~compare:ascending
andList.sort ~cmp:descending
, since they cause the list to be sorted in ascending or descending order, respectively.
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
between t ~low ~high
meanslow <= t <= high
val clamp_exn : t -> min:t -> max:t -> t
clamp_exn t ~min ~max
returnst'
, the closest value tot
such thatbetween t' ~low:min ~high:max
is true.Raises if
not (min <= max)
.
val clamp : t -> min:t -> max:t -> t Base.Or_error.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
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
module Replace_polymorphic_compare : sig ... end
include Comparator.S with type comparator_witness := comparator_witness and type t := t
val comparator : (t, comparator_witness) Comparator.comparator
module Map : Map.S_binable with type Key.t = t with type Key.comparator_witness = comparator_witness
module Set : Set.S_binable with type Elt.t = t with type Elt.comparator_witness = comparator_witness
val hash_fold_t : Base.Hash.state -> t -> Base.Hash.state
val hash : t -> Base.Hash.hash_value
val hashable : t Hashtbl.Hashable.t
module Table : Hashtbl.S_binable with type key = t
module Hash_set : Hash_set.S_binable with type elt = t
module Hash_queue : Hash_queue.S with type key = t
include Base.Pretty_printer.S with type t := t
val pp : Base.Formatter.t -> t -> unit
include Quickcheck.S_range with type t := t
include Quickcheck_intf.S with type t := t
val quickcheck_generator : t Base_quickcheck.Generator.t
val quickcheck_observer : t Base_quickcheck.Observer.t
val quickcheck_shrinker : t Base_quickcheck.Shrinker.t
val gen_incl : t -> t -> t Base_quickcheck.Generator.t
gen_incl lower_bound upper_bound
produces values betweenlower_bound
andupper_bound
, inclusive. It uses an ad hoc distribution that stresses boundary conditions more often than a uniform distribution, while still able to produce any value in the range. Raises iflower_bound > upper_bound
.
val gen_uniform_incl : t -> t -> t Base_quickcheck.Generator.t
gen_uniform_incl lower_bound upper_bound
produces a generator for values uniformly distributed betweenlower_bound
andupper_bound
, inclusive. Raises iflower_bound > upper_bound
.
val create : ?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
val to_parts : t -> Span.Parts.t
val start_of_day : t
Smallest valid ofday.
val start_of_next_day : t
Largest representable ofday; see notes above on how
start_of_next_day
behaves differently from other ofday values.
val approximate_end_of_day : t
A time very close to the end of a day. Not necessarily the largest representable value before
start_of_next_day
, but as close as possible such that using this ofday withTime.of_date_ofday
andTime.to_date
should round-trip to the same date. With floating-point representations of time, this may not be possible for dates extremely far from epoch.The clock-face time represented by
approximate_end_of_day
may vary with different time and ofday representations, depending on their precision.
val to_span_since_start_of_day : t -> Span.t
Note that these names are only really accurate on days without DST transitions. When clocks move forward or back,
of_span_since_start_of_day_exn s
will not necessarily occurs
after that day's midnight.
val of_span_since_start_of_day_exn : Span.t -> t
val of_span_since_start_of_day : Span.t -> t
val span_since_start_of_day_is_valid : Span.t -> Base.Bool.t
Reports whether a span represents a valid time since the start of the day, i.e. whether
of_span_since_start_of_day_exn span
would succeed.
val of_span_since_start_of_day_unchecked : Span.t -> t
of_span_since_start_of_day_unchecked
does not validate that theSpan
represents a validOfday
.Behavior of other
Ofday
accessors is unspecified, but still safe (e.g., won't segfault), if the input does not satisfyspan_since_start_of_day_is_valid
.
val add : t -> Span.t -> t Base.Option.t
add t s
shifts the time of dayt
by the spans
. It returnsNone
if the result is not in the same 24-hour day.
val sub : t -> Span.t -> t Base.Option.t
val next : t -> t Base.Option.t
next t
return the nextt
(next t > t) or None ift
= end of day.
val prev : t -> t Base.Option.t
prev t
return the previoust
(prev t < t) or None ift
= start of day.
val diff : t -> t -> Span.t
diff t1 t2
returns the difference in time between two ofdays, as if they occurred on the same 24-hour day.
val small_diff : t -> t -> Span.t
Returns the time-span separating the two of-days, ignoring the hour information, and assuming that the of-days represent times that are within a half-hour of each other. This is useful for comparing two ofdays in unknown time-zones.
val to_string_trimmed : t -> Base.String.t
Trailing groups of zeroes are trimmed such that the output is printed in terms of the smallest non-zero units among nanoseconds, microseconds, milliseconds, or seconds; or minutes if all of the above are zero.
val to_sec_string : t -> Base.String.t
HH:MM:SS, without any subsecond components. Seconds appear even if they are zero.
val of_string_iso8601_extended : ?pos:Base.Int.t -> ?len:Base.Int.t -> Base.String.t -> t
24-hour times according to the ISO 8601 standard. This function can raise.
val to_millisecond_string : t -> Base.String.t
with milliseconds
val to_millisec_string : t -> Base.String.t