package tezos-protocol-alpha

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t
type period = t

Represents a period of time as a non-negative integer.

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 equal : t -> t -> bool
val max : t -> t -> t
val min : t -> t -> t
val encoding : period Data_encoding.t
val rpc_arg : period Tezos_protocol_environment_alpha__Environment.RPC_arg.t
val pp : Stdlib.Format.formatter -> period -> unit
val to_seconds : period -> int64

Returns the number of seconds contained in the period.

val of_seconds : int64 -> (period, Tezos_protocol_environment_alpha__Environment.Error_monad.error Tezos_protocol_environment_alpha__Environment.Error_monad.trace) Stdlib.result

Converts a number of seconds to a period.

of_second s fails if s is not positive.

val of_seconds_exn : int64 -> period

Converts a number of seconds to period.

of_second s fails if s is not positive. It should only be used at toplevel for constants.

val add : period -> period -> (period, Tezos_protocol_environment_alpha__Environment.Error_monad.error Tezos_protocol_environment_alpha__Environment.Error_monad.trace) Stdlib.result

Safe addition of periods, guarded against overflow.

val (+?) : period -> period -> (period, Tezos_protocol_environment_alpha__Environment.Error_monad.error Tezos_protocol_environment_alpha__Environment.Error_monad.trace) Stdlib.result

Alias for add.

val mult : int32 -> period -> (period, Tezos_protocol_environment_alpha__Environment.Error_monad.error Tezos_protocol_environment_alpha__Environment.Error_monad.trace) Stdlib.result

Safe multiplication by a positive integer. Guarded against overflow.

val zero : period
val one_second : period
val one_minute : period
val one_hour : period
val compare : period -> period -> int

compare x y returns 0 if x is equal to y, a negative integer if x is shorter than y, and a positive integer if x is longer than y.

OCaml

Innovation. Community. Security.