Up

Module Ofday

Signature

include module type of Core.Ofday with type t = Core.Ofday.t with module Zoned := Core.Ofday.Zoned
type t = Core.Ofday.t

Times 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 savings 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.)

val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
val __bin_read_t__ : (int -> t) Core_kernel.Std.Bin_prot.Read.reader
module Zoned : sig .. end
include Core_kernel.Std.Comparable_binable with type t := t
include Comparable_intf.S_common
include Comparable_intf.Polymorphic_compare
include Polymorphic_compare_intf.Infix
type 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
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int

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.

val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t

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 Or_error.t
include Comparator.S with type t := t
type t
type comparator_witness
include Comparable_intf.Validate with type t := t
type t
val validate_lbound : min:t Maybe_bound.t -> t Validate.check
val validate_ubound : max:t Maybe_bound.t -> t Validate.check
val validate_bound : min:t Maybe_bound.t -> max:t Maybe_bound.t -> t Validate.check
include Comparable_intf.Map_and_set_binable with type t := t with type comparator_witness := comparator_witness
type t
include Comparator.S with type t := t
type t
type comparator_witness
include Core_kernel.Std.Comparable.With_zero with type t := t
type t
val validate_positive : t Core_kernel.Validate.check
val validate_non_negative : t Core_kernel.Validate.check
val validate_negative : t Core_kernel.Validate.check
val validate_non_positive : t Core_kernel.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 -> Core_kernel.Sign0.t

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

include Core_kernel.Std.Floatable with type t := t
type t
val of_float : float -> t
val to_float : t -> float
include Core_kernel.Std.Hashable_binable with type t := t
type t
val hash : t -> int
module Table : Hashable.Hashtbl.S_binable with type key = t
include Core_kernel.Std.Pretty_printer.S with type t := t
type t
val pp : Format.formatter -> t -> unit
include Core_kernel.Std.Robustly_comparable with type t := t
type 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
include Core_kernel.Std.Stringable with type t := t
type t
val of_string : string -> t
val to_string : t -> string
val create : ?hr:int -> ?min:int -> ?sec:int -> ?ms:int -> ?us:int -> unit -> t
val to_parts : t -> Core.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.

val to_span_since_start_of_day : t -> Core.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 s will not necessarily occur s after that day's midnight.

val of_span_since_start_of_day : Core.Span.t -> t

Due to a circular reference, this declaration is found in time.mli.

val now : zone:Zone.t -> t

val add : t -> Core.Span.t -> t 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 -> Core.Span.t -> t option
val diff : t -> t -> Core.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 -> Core.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 -> string

trailing seconds and subseconds are trimmed off if they are 0

val to_sec_string : t -> string

trailing milliseconds are trimmed

val of_string_iso8601_extended : ?pos:int -> ?len:int -> string -> t
val to_millisec_string : t -> string

with milliseconds

module Stable : sig .. end
module Zoned : sig .. end
val now : zone:Core.Zone.t -> t