Module Core_kernel__.Ofday_helpers
val parse : Core_kernel__.Import.string -> f:(Core_kernel__.Import.string -> hr:Core_kernel__.Import.int -> min:Core_kernel__.Import.int -> sec:Core_kernel__.Import.int -> subsec_pos:Core_kernel__.Import.int -> subsec_len:Core_kernel__.Import.int -> 'a) -> 'a
Parses a given time-of-day string. If the string is invalid, raises. If the string is valid, calls
f
with the string, the parsed numbers of hours, minutes, and seconds, and the position and length of the substring representing subseconds, which can be parsed with the appropriate precision for a given representation.The substring
String.sub string ~pos:subsec_pos ~len:subsec_len
will be either the empty string (representing zero) or a decimal point ('.') and one or more digits and/or underscores (representing a fractional number of seconds in decimal notation).Illegal hours, minutes, or seconds values are rejected by
parse
, as are times with the hour of 24 and non-zero minutes or seconds. The time "24:00:00" itself is accepted. If seconds is 60 (a leap second), the client will be passed~subsec_len:0
regardless of the subsecond part.
val parse_iso8601_extended : ?pos:Core_kernel__.Import.int -> ?len:Core_kernel__.Import.int -> Core_kernel__.Import.string -> f:(Core_kernel__.Import.string -> hr:Core_kernel__.Import.int -> min:Core_kernel__.Import.int -> sec:Core_kernel__.Import.int -> subsec_pos:Core_kernel__.Import.int -> subsec_len:Core_kernel__.Import.int -> 'a) -> 'a
As
parse
, for strings in ISO 8601 extended format. Allows substring parsing via~pos
and~len
arguments.
val invalid_string : Core_kernel__.Import.string -> reason:Core_kernel__.Import.string -> _
Raises ofday-parsing errors for the given string, annotated with the given reason. Useful inside the
~f
argument toparse
in order to generate error messages that are consistent with whatparse
raises.
val am_suffixes : Core_kernel__.Import.string Core_kernel__.Import.list Core_kernel.Lazy.t
Allowed AM/PM suffixes; useful for testing.
val pm_suffixes : Core_kernel__.Import.string Core_kernel__.Import.list Core_kernel.Lazy.t