PrevUpHomeNext

getNextLedgerTimeResolution

Calculates the close time resolution for the specified ledger.

Synopsis
template<
    class Rep,
    class Period,
    class Seq>
std::chrono::duration< Rep, Period >
getNextLedgerTimeResolution(
    std::chrono::duration< Rep, Period > previousResolution,
    bool previousAgree,
    Seq ledgerSeq);
Description

The Ripple protocol uses binning to represent time intervals using only one timestamp. This allows servers to derive a common time for the next ledger, without the need for perfectly synchronized clocks. The time resolution (i.e. the size of the intervals) is adjusted dynamically based on what happened in the last ledger, to try to avoid disagreements.

Parameters

Name

Description

previousResolution

the resolution used for the prior ledger

previousAgree

whether consensus agreed on the close time of the prior ledger

ledgerSeq

the sequence number of the new ledger

previousResolution must be a valid bin from ledgerPossibleTimeResolutions

Template Parameters

Type

Description

Rep

Type representing number of ticks in std::chrono::duration

Period

An std::ratio representing tick period in std::chrono::duration

Seq

Unsigned integer-like type corresponding to the ledger sequence number. It should be comparable to 0 and support modular division. Built-in and tagged_integers are supported.

Header

#include <ripple/consensus/LedgerTiming.h>


PrevUpHomeNext