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 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_sexp : CCSexp.t -> (t, string) Stdlib.result
val to_sexp : t -> CCSexp.t