module Zone: Zone
type
t
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 Stringable
val find : string -> t option
find name
looks up a t
by its name and returns it.val find_office : [ `chi | `hkg | `ldn | `nyc ] -> t
find_office office
a more type-safe interface for pulling timezones related to
existing Jane Street offices/locations.val find_exn : string -> t
val machine_zone : ?refresh:bool -> unit -> t
machine_zone ?refresh ()
returns the machines zone (t). It does this by first
looking for a value in the environment variable "TZ", and loading the named zone if
it is set. If "TZ" is not set it reads /etc/localtime directly.
The first call to machine_zone is cached, so there is no need to cache it locally. The cache can be bypassed and refreshed by setting ~refresh to true.
Note that this function can throw an exception if the TZ time variable is
misconfigured or if the appropriate timezone files can't be found because of the way
the box is configured. We don't put an _exn on this function because that
misconfiguration is quite rare.
val likely_machine_zones : string list Pervasives.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 call to machine_zoneval of_utc_offset : hours:int -> t
of_utc_offset offset
returns a timezone with a static UTC offset (given in
hours).val default_utc_offset_deprecated : t -> int
default_utc_offset
returns the UTC offset of default regime for timezone t
in
seconds. Note: the default utc offset may not reflect the current utc offset.val utc : t
utc
the UTC time zone. Included for convenienceval abbreviation : t -> float -> string
abbreviation zone t
returns t abbreviation name such as EDT, EST, JST of given
zone
at the time t
. This string conversion is one-way only, and cannot reliably
be turned back into a tval name : t -> string
name zone
returns the name of the time zoneval 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.val digest : t -> string option
digest t
return the MD5 digest of the file the t was created from (if any)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.val shift_epoch_time : t -> [ `Local | `UTC ] -> float -> float
shift_epoch_time zone [`Local | `UTC] time
Takes an epoch (aka "unix") time given
either in local or in UTC (as indicated in the arguments) and shifts it according to
the local time regime in force in zone. That is, given a Local epoch time it will
return the corresponding UTC timestamp and vice versa. This function is low level,
and is not intended to be called by most client code. Use the high level functions
provided in Time instead.val pp : Format.formatter -> t -> unit
exception Unknown_zone of string
exception Invalid_file_format of string
module Stable: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_ml.reader
val bin_read_t_ : t Bin_prot.Unsafe_read_c.reader
val bin_read_t__ : (int -> t) Bin_prot.Unsafe_read_c.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_ml.writer
val bin_write_t_ : t Bin_prot.Unsafe_write_c.writer
val bin_writer_t : t Bin_prot.Type_class.writer