Module Core__Core_time_float.Zone

include module type of sig ... end
val sexp_of_t : t ‑> Base.Sexp.t
val compare : t ‑> t ‑> Core_kernel__.Import.int
val input_tz_file : zonename:Core_kernel__.Import.string ‑> filename:Core_kernel__.Import.string ‑> t
val of_utc_offset : hours:Core_kernel__.Import.int ‑> t
val utc : t
val reset_transition_cache : t ‑> Core_kernel__.Import.unit
module Index = Time.Zone.Index
val index : t ‑> Time0.t ‑> Index.t
val index_of_relative : t ‑> Time0.Relative_to_unspecified_zone.t ‑> Index.t
val index_offset_from_utc_exn : t ‑> Index.t ‑> Time0.Span.t
val index_abbreviation_exn : t ‑> Index.t ‑> Core_kernel__.Import.string
val index_has_prev_clock_shift : t ‑> Index.t ‑> Core_kernel__.Import.bool
val index_prev_clock_shift_time_exn : t ‑> Index.t ‑> Time0.t
val index_prev_clock_shift_amount_exn : t ‑> Index.t ‑> Time0.Span.t
val index_has_next_clock_shift : t ‑> Index.t ‑> Core_kernel__.Import.bool
val index_next_clock_shift_time_exn : t ‑> Index.t ‑> Time0.t
val index_next_clock_shift_amount_exn : t ‑> Index.t ‑> Time0.Span.t
val abbreviation : t ‑> Time0.t ‑> Core_kernel__.Import.string
val absolute_time_of_relative_time : t ‑> Time0.Relative_to_unspecified_zone.t ‑> Time0.t
val relative_time_of_absolute_time : t ‑> Time0.t ‑> Time0.Relative_to_unspecified_zone.t
val next_clock_shift : t ‑> strictly_after:Time0.t ‑> (Time0.t * Time0.Span.t) Core_kernel__.Import.option
val prev_clock_shift : t ‑> at_or_before:Time0.t ‑> (Time0.t * Time0.Span.t) Core_kernel__.Import.option
include Core__.Core_zone.Extend_zone with type t := t
type t
include Core__.Import.Identifiable.S with type t := t
type t
include sig ... end
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
val hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.state
val hash : t ‑> Base.Hash.hash_value
val t_of_sexp : Base.Sexp.t ‑> t
val sexp_of_t : t ‑> Base.Sexp.t
include Core__.Import.Identifiable.S_common with type t := t
type t
include sig ... end
val compare : t ‑> t ‑> Core_kernel__.Import.int
val hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.state
val hash : t ‑> Base.Hash.hash_value
val sexp_of_t : t ‑> Base.Sexp.t
include Core_kernel__.Import.Stringable.S with type t := t
type t
val of_string : string ‑> t
val to_string : t ‑> string
include Core_kernel__.Import.Pretty_printer.S with type t := t
type t
val pp : Base.Formatter.t ‑> t ‑> unit
include Core_kernel.Comparable.S_binable with type t := t
include Core_kernel__.Comparable_intf.S_common
include Base.Comparable.S
include Base__.Comparable_intf.Polymorphic_compare
include Base.Comparisons.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

compare t1 t2 returns 0 if t1 is equal to t2, a negative integer if t1 is less than t2, and a positive integer if t1 is greater than t2.

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 ~compare: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

between t ~low ~high means low <= t <= high

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.Comparator.S with type t := t
type t
type comparator_witness
include Base__.Comparable_intf.Validate with type t := t
type 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.Hashable.S_binable with type t := t
type t
include sig ... end
val hash_fold_t : Base.Hash.state ‑> t ‑> Base.Hash.state
val hash : t ‑> Base.Hash.hash_value
val find : string ‑> t option

find name looks up a t by its name and returns it. This also accepts some aliases, including:

  • chi -> America/Chicago
  • nyc -> America/New_York
  • hkg -> Asia/Hong_Kong
  • lon -> Europe/London
  • tyo -> Asia/Tokyo
val find_exn : string ‑> t

local is the machine's local timezone, as determined from the TZ environment variable or the /etc/localtime file. It is computed from the state of the process environment and on-disk tzdata database at some unspecified moment prior to its first use, so its value may be unpredictable if that state changes during program operation. Arguably, changing the timezone of a running program is a problematic operation anyway -- most people write code assuming the clock doesn't suddenly jump several hours without warning.

Note that any function using this timezone can throw an exception if the TZ environment variable is misconfigured or if the appropriate timezone files can't be found because of the way the box is configured. We don't sprinkle _exn all over all the names in this module because such misconfiguration is quite rare.

val likely_machine_zones : string list Core__.Import.ref

likely_machine_zones is a list of zone names that will be searched first when trying to determine the machine zone of a box. Setting this to a likely set of zones for your application will speed the very first use of the local timezone.

val of_utc_offset : hours:int ‑> t

of_utc_offset offset returns a timezone with a static UTC offset (given in hours).

val utc : t

utc the UTC time zone. Included for convenience

val initialized_zones : unit ‑> (string * t) list

initialized_zones () returns a sorted list of time zone names that have been loaded from disk thus far.

Low-level functions

The functions below are lower level and should be used more rarely.

val init : unit ‑> unit

init () pre-load all available time zones from disk, this function has no effect if it is called multiple times. Time zones will otherwise be loaded at need from the disk on the first call to find/find_exn.