package timedesc

  1. Overview
  2. Docs
type error = [
  1. | `Does_not_exist
  2. | `Invalid_year of int
  3. | `Invalid_day_of_year of int
  4. | `Invalid_hour of int
  5. | `Invalid_minute of int
  6. | `Invalid_second of int
  7. | `Invalid_s_frac of float
  8. | `Invalid_ns of int
  9. | `Invalid_tz_info of string option * Span.t
]
exception Error_exn of error
val string_of_error : error -> string
val make : ?tz:Time_zone.t -> ?ns:int -> ?s_frac:float -> year:int -> day_of_year:int -> hour:int -> minute:int -> second:int -> unit -> (t, error) Stdlib.result
val make_exn : ?tz:Time_zone.t -> ?ns:int -> ?s_frac:float -> year:int -> day_of_year:int -> hour:int -> minute:int -> second:int -> unit -> t
val make_unambiguous : ?tz:Time_zone.t -> ?ns:int -> ?s_frac:float -> year:int -> day_of_year:int -> hour:int -> minute:int -> second:int -> offset_from_utc:Span.t -> unit -> (t, error) Stdlib.result
val make_unambiguous_exn : ?tz:Time_zone.t -> ?ns:int -> ?s_frac:float -> year:int -> day_of_year:int -> hour:int -> minute:int -> second:int -> offset_from_utc:Span.t -> unit -> t

Pretty printing

val pp_iso8601 : ?frac_s:int -> unit -> Stdlib.Format.formatter -> t -> unit
val pp_iso8601_milli : Stdlib.Format.formatter -> t -> unit
val pp_iso8601_micro : Stdlib.Format.formatter -> t -> unit
val pp_iso8601_nano : Stdlib.Format.formatter -> t -> unit
val to_iso8601 : ?frac_s:int -> t -> string option
val to_iso8601_milli : t -> string option
val to_iso8601_micro : t -> string option
val to_iso8601_nano : t -> string option

Parsing

val of_iso8601 : string -> (t, 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 -> t
OCaml

Innovation. Community. Security.