package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

User-friendly interface

type t

The type of a time-zone.

bin_io and sexp representations of Zone.t are the name of the zone, and not the full data that is read from disk when Zone.find is called. The full Zone.t is reconstructed on the receiving/reading side by reloading the zone file from disk. Any zone name that is accepted by find is acceptable in the bin_io and sexp representations.

include sig ... end
val sexp_of_t : t -> Sexplib.Sexp.t
val compare : t -> t -> Base.Int.t
val input_tz_file : zonename:Base.String.t -> filename:Base.String.t -> t

input_tz_file ~zonename ~filename read in filename and return t with name t = zonename

val likely_machine_zones : Base.String.t Base.List.t Base.Ref.t

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:Base.Int.t -> 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 name : t -> Base.String.t
val original_filename : t -> Base.String.t Base.Option.t

original_filename t return the filename t was loaded from (if any)

val digest : t -> Md5.t Base.Option.t

digest t return the MD5 digest of the file the t was created from (if any)

module Full_data : sig ... end
val abbreviation : t -> float -> Base.String.t

abbreviation t time returns the abbreviation name (such as EDT, EST, JST) of given zone t at time. This string conversion is one-way only, and cannot reliably be turned back into a t.

val absolute_time_of_relative_time : t -> float -> float

absolute_time_of_relative_time and relative_time_of_absolute_time convert times between absolute (time from epoch in UTC) and relative (shifted according to time zone and daylight savings) forms. These are low level functions not intended for most clients.

val relative_time_of_absolute_time : t -> float -> float
val next_clock_shift : t -> after:float -> (float * float) Base.Option.t

Takes a Time.t and returns the next Time.t strictly after it, if any, that the time zone UTC offset changes, and by how much it does so.

val prev_clock_shift : t -> before:float -> (float * float) Base.Option.t

As next_clock_shift, but strictly *before* the given time.

val reset_transition_cache : t -> Base.Unit.t

For performance testing only; reset_transition_cache t resets an internal cache in t used to speed up repeated lookups of the same clock shift transition.

OCaml

Innovation. Community. Security.