package core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of struct include Core_kernel.Core_kernel_private.Time_float0.Ofday end
include sig ... end
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (Base.Int.t -> 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
val t_of_sexp : Sexplib.Sexp.t -> t
val sexp_of_t : t -> Sexplib.Sexp.t
include Core_kernel.Interfaces.Comparable_binable with type t := t
include Base.Comparable_intf.S with type t := t
include Base.Comparable_intf.Polymorphic_compare with type t := t
include Base.Polymorphic_compare_intf.Infix with type t := 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

-1 means "less than", 0 means "equal", 1 means "greater than", and other values should not be returned

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 Base.Or_error.t
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
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 Base.Pretty_printer.S with type t := t
val pp : Base__.Import.Caml.Format.formatter -> t -> unit
include Core_kernel.Interfaces.Robustly_comparable with type t := 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

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.Interfaces.Stringable with type t := t
val of_string : string -> t
val to_string : t -> string
val create : ?hr:Base.Int.t -> ?min:Base.Int.t -> ?sec:Base.Int.t -> ?ms:Base.Int.t -> ?us:Base.Int.t -> Base.Unit.t -> 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_kernel.Core_kernel_private.Time_float0.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_kernel.Core_kernel_private.Time_float0.Span.t -> t

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 next : t -> t Base.Option.t

next t return the next t (next t > t) or None if t = end of day.

val prev : t -> t Base.Option.t

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 -> Base.String.t

trailing seconds and subseconds are trimmed off if they are 0

val to_sec_string : t -> Base.String.t

trailing milliseconds are trimmed

val of_string_iso8601_extended : ?pos:Base.Int.t -> ?len:Base.Int.t -> Base.String.t -> t
val to_millisec_string : t -> Base.String.t

with milliseconds

module Zoned : sig ... end
val now : zone:Core_kernel.Time.Zone.t -> t
OCaml

Innovation. Community. Security.