Module type Zone.S
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.
val sexp_of_t : t -> Ppx_sexp_conv_lib.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
input_tz_file ~zonename ~filename
read infilename
and returnt
withname t
=zonename
val likely_machine_zones : Core_kernel__.Import.string Core_kernel__.Import.list Core_kernel__.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:Core_kernel__.Import.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 name : t -> Core_kernel__.Import.string
val original_filename : t -> Core_kernel__.Import.string Core_kernel__.Import.option
original_filename t
return the filenamet
was loaded from (if any)
val digest : t -> Core_kernel.Md5.t Core_kernel__.Import.option
digest t
return the MD5 digest of the file the t was created from (if any)
val reset_transition_cache : t -> Core_kernel__.Import.unit
For performance testing only;
reset_transition_cache t
resets an internal cache int
used to speed up repeated lookups of the same clock shift transition.
module Index : sig ... end
A time zone index refers to a range of times delimited by DST transitions at one or both ends. Every time belongs to exactly one such range. The times of DST transitions themselves belong to the range for which they are the lower bound.
val index : t -> Time_in_seconds.t -> Index.t
Gets the index of a time.
val index_of_date_and_ofday : t -> Time_in_seconds.Date_and_ofday.t -> Index.t
val index_offset_from_utc_exn : t -> Index.t -> Time_in_seconds.Span.t
Gets the UTC offset of times in a specific range.
This can raise if you use an
Index.t
that is out of bounds for thist
.
val index_abbreviation_exn : t -> Index.t -> Core_kernel__.Import.string
index_abbreviation_exn t index
returns the abbreviation name (such as EDT, EST, JST) of given zonet
for the range ofindex
. This string conversion is one-way only, and cannot reliably be turned back into at
. This function reads and writes the zone's cached index. Raises ifindex
is out of bounds fort
.
val index_has_prev_clock_shift : t -> Index.t -> Core_kernel__.Import.bool
Accessors for the DST transitions delimiting the start and end of a range, if any. The
_exn
accessors raise if there is no such transition. These accessors are split up to increase performance and improve allocation; they are intended as a low-level back-end for commonly-used time conversion functions. SeeTime.Zone
andTime_ns.Zone
for higher-level accessors that return an optional tuple for clock shifts in either direction.
val index_prev_clock_shift_time_exn : t -> Index.t -> Time_in_seconds.t
val index_prev_clock_shift_amount_exn : t -> Index.t -> Time_in_seconds.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 -> Time_in_seconds.t
val index_next_clock_shift_amount_exn : t -> Index.t -> Time_in_seconds.Span.t