package tezos-base

  1. Overview
  2. Docs

time

The out-of-protocol view of in-protocol timestamps. The precision of in-protocol timestamps are only precise to the second.

Note that the out-of-protocol view does not necessarily match the in-protocol representation.

type t

The type of protocol times

val epoch : t

Unix epoch is 1970-01-01 00:00:00 +0000 (UTC)

include Tezos_stdlib.Compare.S with type t := t
val (=) : t -> t -> bool
val (<>) : t -> t -> bool
val (<) : t -> t -> bool
val (<=) : t -> t -> bool
val (>=) : t -> t -> bool
val (>) : t -> t -> bool
val compare : t -> t -> int
val equal : t -> t -> bool
val max : t -> t -> t
val min : t -> t -> t
val add : t -> int64 -> t

add t s is s seconds later than t

val diff : t -> t -> int64

diff a b is the number of seconds between a and b. It is negative if b is later than a.

Conversions to and from string representations.

val of_notation : string -> t option
val of_notation_exn : string -> t
val to_notation : t -> string

Conversion to and from "number of seconds since epoch" representation.

val of_seconds : int64 -> t
val to_seconds : t -> int64

Serialization functions

val encoding : t Data_encoding.t
val rfc_encoding : t Data_encoding.t
val rpc_arg : t Tezos_rpc.RPC_arg.t

Pretty-printing functions

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