package octez-libs

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Time.SystemSource

System time

A representation of timestamps.

NOTE: This representation is limited to times between 0000-01-01 00:00:00 UTC and 9999-12-31 23:59:59.999999999999 UTC

Sourcetype t = Ptime.t
Sourceval now : unit -> Ptime.t

The current time according to the system clock

Sourceval epoch : t

Unix epoch is 1970-01-01 00:00:00.000000000000 UTC

Sourcemodule Span : sig ... end

Conversions to and from Protocol time

Note that converting system time to protocol time truncates any subsecond precision.

Sourceval of_protocol_opt : Protocol.t -> t option

Convert a Protocol time into a System time.

Return None if the Protocol time is outside the RFC3339 range.

Sourceval of_protocol_exn : Protocol.t -> t

Convert a Protocol time into a System time.

Raises Invalid_argument if the Protocol time is outside the RFC3339 range.

Sourceval to_protocol : t -> Protocol.t

Convert a System time into a Protocol time.

Note that subseconds are truncated.

Conversions to and from string (using RFC3339)

Sourceval of_notation_opt : string -> t option

Convert a string in the RFC3339 format (e.g., "1970-01-01T00:00:00.000-00:00") into a system time. Invalid RFC3339 notations will return None.

Note that years outside the 0000-9999 range are invalid RFC3339-wise.

Sourceval of_notation_exn : string -> t

Convert a string in the RFC3339 format (e.g., "1970-01-01T00:00:00.000-00:00") into a system time. Invalid RFC3339 notations will raise Invalid_argument.

Note that years outside the 0000-9999 range are invalid RFC3339-wise.

Sourceval to_notation : t -> string

Convert a system time into an RFC3339 notation (e.g., "1970-01-01T00:00:00.000-00:00").

Serialization

Sourceval encoding : t Data_encoding.t
Sourceval rfc_encoding : t Data_encoding.t
Sourceval rpc_arg : t Tezos_rpc.Arg.t

Pretty-printing

Sourceval pp_hum : Format.formatter -> t -> unit

Timestamping data

Sourcetype 'a stamped = {
  1. data : 'a;
  2. stamp : t;
}

Data with an associated time stamp.

Sourceval stamped_encoding : 'a Data_encoding.t -> 'a stamped Data_encoding.t
Sourceval stamp : time:t -> 'a -> 'a stamped

stamp d is a timestamped version of d.

Sourceval pp_stamped : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a stamped -> unit
Sourceval recent : ('a * t) option -> ('a * t) option -> ('a * t) option

recent a b is either a or b (which ever carries the most recent timestamp), or None if both a and b are None.

Helper modules

Sourceval hash : t -> int
include Tezos_stdlib.Compare.S with type t := t
Sourceval (=) : t -> t -> bool

x = y iff compare x y = 0

Sourceval (<>) : t -> t -> bool

x <> y iff compare x y <> 0

Sourceval (<) : t -> t -> bool

x < y iff compare x y < 0

Sourceval (<=) : t -> t -> bool

x <= y iff compare x y <= 0

Sourceval (>=) : t -> t -> bool

x >= y iff compare x y >= 0

Sourceval (>) : t -> t -> bool

x > y iff compare x y > 0

Sourceval compare : t -> t -> int

compare an alias for the functor parameter's compare function

Sourceval equal : t -> t -> bool

equal x y iff compare x y = 0

Sourceval max : t -> t -> t

max x y is x if x >= y otherwise it is y

Sourceval min : t -> t -> t

min x y is x if x <= y otherwise it is y

OCaml

Innovation. Community. Security.