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 ->
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 -> 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 : Format.formatter -> t -> unit
val pp_rfc3339_micro : Format.formatter -> t -> unit
val pp_rfc3339_nano : 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 -> Format.formatter -> t -> unit
Alias to pp_rfc3339
val pp_iso8601_milli : Format.formatter -> t -> unit
val pp_iso8601_micro : Format.formatter -> t -> unit
val pp_iso8601_nano : 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
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 : Sexplib.Sexp.t -> (t, string) result
val to_sexp : t -> Sexplib.Sexp.t