type underlying
Time of day.
t
represents a clock-face time of day. Usually this is equivalent to a time-offset
from midnight, and each t
occurs exactly once in each calendar day. However, when
daylight saving time begins or ends, some clock face times (and therefore t
's) can
occur more than once per day or not at all, and e.g. 04:00 can occur three or five
hours after midnight, so knowing your current offset from midnight is *not* in general
equivalent to knowing the current t
.
(See Zone for tools to help you cope with DST.)
include sig ... end
val t_of_sexp : Sexplib.Sexp.t ‑> t
val sexp_of_t : t ‑> Sexplib.Sexp.t
val bin_t : t Bin_prot.Type_class.t
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (Core_kernel__.Import.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 bin_shape_t : Bin_prot.Shape.t
include Core_kernel__.Std_internal.Comparable_binable with type t := t
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable_intf.S
include Base.Comparable_intf.Polymorphic_compare
ascending
is identical to compare
. descending x y = ascending y x
. These are
intended to be mnemonic when used like List.sort ~cmp: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.t
include Base.Comparator.S with type t := t
val comparator : (t, comparator_witness) Base.Comparator.comparator
include Base.Comparable_intf.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
module Replace_polymorphic_compare : Core_kernel__.Comparable_intf.Polymorphic_compare with type t := t
include Core_kernel__.Comparable_intf.Map_and_set_binable with type t := t with type comparator_witness := comparator_witness
include Core_kernel.Comparator.S with type t := t
val comparator : (t, comparator_witness) Core_kernel.Comparator.comparator
module Map : Core_kernel__.Core_map.S_binable with type Key.t = t with type Key.comparator_witness = comparator_witness
module Set : Core_kernel__.Core_set.S_binable with type Elt.t = t with type Elt.comparator_witness = comparator_witness
include Core_kernel.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.
include Core_kernel__.Std_internal.Hashable_binable with type t := t
val hash : t ‑> Core_kernel__.Import.int
val hashable : t Core_kernel.Hashable.Hashtbl.Hashable.t
module Table : Core_kernel.Hashable.Hashtbl.S_binable with type key = t
module Hash_set : Core_kernel.Hash_set.S_binable with type elt = t
module Hash_queue : Core_kernel.Hash_queue.S with type Key.t = t
include Core_kernel__.Import.Pretty_printer.S with type t := t
val pp : Caml.Format.formatter ‑> t ‑> unit
module Span : Core_kernel__.Span_intf.Span
of_string
supports and correctly interprets 12h strings with the following suffixes:
"A", "AM", "A.M.", "A.M" "P", "PM", "P.M.", "P.M"
as well as the lowercase and space-prefixed versions of these suffixes.
of_string
also fully supports 24h wall-clock times.
to_string
only produces the 24h format.
include Core_kernel__.Std_internal.Stringable with type t := t
val of_string : string ‑> t
val to_string : t ‑> string
val create : ?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 ‑> Core_kernel__.Import.unit ‑> t
val to_parts : t ‑> Span.Parts.t
val start_of_day : t
Smallest valid ofday. There is no exposed end_of_day value because the upper end of the range is not closed.
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 s
will not necessarily occur
s
after that day's midnight.
val add : t ‑> Span.t ‑> t Core_kernel__.Import.option
add t s
shifts the time of day t
by the span s
. It returns None
if the result
is not in the same 24-hour day.
val sub : t ‑> Span.t ‑> t Core_kernel__.Import.option
val next : t ‑> t Core_kernel__.Import.option
next t
return the next t
(next t > t) or None if t
= end of day.
val prev : t ‑> t Core_kernel__.Import.option
prev t
return the previous t
(prev t < t) or None if t
= start of day.
diff t1 t2
returns the difference in time between two ofdays, as if they occurred on
the same 24-hour day.
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 ‑> Core_kernel__.Import.string
trailing seconds and subseconds are trimmed off if they are 0
val of_string_iso8601_extended : ?pos:Core_kernel__.Import.int ‑> ?len:Core_kernel__.Import.int ‑> Core_kernel__.Import.string ‑> t
module Stable : sig ... end