Calculates the close time resolution for the specified ledger.
template< class Rep, class Period, class Seq> std::chrono::duration< Rep, Period > getNextLedgerTimeResolution( std::chrono::duration< Rep, Period > previousResolution, bool previousAgree, Seq ledgerSeq);
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.
Name |
Description |
---|---|
|
the resolution used for the prior ledger |
|
whether consensus agreed on the close time of the prior ledger |
|
the sequence number of the new ledger |
previousResolution must be a valid bin from ledgerPossibleTimeResolutions
Type |
Description |
---|---|
|
Type representing number of ticks in std::chrono::duration |
|
An std::ratio representing tick period in std::chrono::duration |
|
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. |
#include <ripple/consensus/LedgerTiming.h>