Library
Module
Module type
Parameter
Class
Class type
Timestamp specific functions
type t = timestamp
val min_val : t
val max_val : t
val now : unit -> t
val to_s_ns : t -> int64 * int
val to_float_s : t -> float
Returns span in seconds, fraction represents subsecond span.
Representation is the same as result from Unix.gettimeofday
.
val of_float_s : float -> t
Convert from span in seconds, fraction represents subsecond span
Representation is the same as result from Unix.gettimeofday
.
val get_s : t -> int64
val get_ns_offset : t -> int
val pp :
?display_using_tz:Time_zone.t ->
?format:string ->
unit ->
Stdlib.Format.formatter ->
t ->
unit
Pretty printing for timestamp.
Follows same format string rules and default format string as pp
.
val to_string :
?display_using_tz:Time_zone.t ->
?format:string ->
timestamp ->
string
val pp_rfc3339 : ?frac_s:int -> unit -> Stdlib.Format.formatter -> t -> unit
Pretty prints according to RFC3339, e.g. 2020-01-20T13:00:00.0001+10
.
frac_s
determines the number of fractional digits to include.
val pp_rfc3339_milli : Stdlib.Format.formatter -> t -> unit
val pp_rfc3339_micro : Stdlib.Format.formatter -> t -> unit
val pp_rfc3339_nano : Stdlib.Format.formatter -> t -> unit
val to_rfc3339 : ?frac_s:int -> t -> string
val to_rfc3339_milli : t -> string
val to_rfc3339_micro : t -> string
val to_rfc3339_nano : t -> string
val pp_iso8601 : ?frac_s:int -> unit -> Stdlib.Format.formatter -> t -> unit
Alias to pp_rfc3339
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
Alias to to_rfc3339
val to_iso8601_milli : t -> string
val to_iso8601_micro : t -> string
val to_iso8601_nano : t -> string
val pp_rfc9110 : Stdlib.Format.formatter -> t -> unit
Warning: Subsecond value is truncated
val to_rfc9110 : t -> string
Warning: Subsecond value is truncated
val pp_http : Stdlib.Format.formatter -> t -> unit
Alias to pp_rfc9110
val to_http : t -> string
Alias to to_rfc9110
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
val of_rfc9110 : string -> (t, string) Stdlib.result
See of_rfc9110
val of_rfc9110_exn : string -> t
val of_http : string -> (t, string) Stdlib.result
Alias to of_rfc9110
val of_http_exn : string -> t
Alias to of_rfc9110_exn