package timedesc

  1. Overview
  2. Docs
type zoneless
type error_when_zoned = [
  1. | `Does_not_exist
  2. | `Invalid_tz_info of string option * Span.t
]
exception Error_when_zoned_exn of error_when_zoned

Constructors

val make : Date.t -> Time.t -> zoneless

Accessors

val date : zoneless -> Date.t
val time : zoneless -> Time.t

Comparison

val equal : zoneless -> zoneless -> bool

Conversion

val to_timestamp_local : zoneless -> timestamp

This yields a "local timestamp" - we pretend we are in the UTC time zone, and calculate seconds since unix epoch

val to_zoned : ?tz:Time_zone.t -> zoneless -> (t, error_when_zoned) Stdlib.result

tz defaults to result of Utils.get_local_tz_for_arg

val to_zoned_exn : ?tz:Time_zone.t -> zoneless -> t
val to_zoned_unambiguous : ?tz:Time_zone.t -> offset_from_utc:Span.t -> zoneless -> (t, error_when_zoned) Stdlib.result
val to_zoned_unambiguous_exn : ?tz:Time_zone.t -> offset_from_utc:Span.t -> zoneless -> t
val of_zoned : t -> zoneless

Parsing

val of_iso8601 : string -> (zoneless, string) Stdlib.result

Parses a subset of ISO8601, up to 9 fractional digits for second (nanosecond precision).

If more than 9 fractional digits are provided, then only the first 9 digits are used, i.e. no rounding.

val of_iso8601_exn : string -> zoneless
val maybe_zoneless_of_iso8601 : string -> ([ `Zoned of t | `Zoneless of zoneless ], string) Stdlib.result
val maybe_zoneless_of_iso8601_exn : string -> [ `Zoned of t | `Zoneless of zoneless ]

Sexp

val to_sexp : zoneless -> Sexplib.Sexp.t
val of_sexp : Sexplib.Sexp.t -> (zoneless, string) Stdlib.result
OCaml

Innovation. Community. Security.