20 #ifndef RIPPLE_APP_LEDGER_LEDGERTIMING_H_INCLUDED
21 #define RIPPLE_APP_LEDGER_LEDGERTIMING_H_INCLUDED
23 #include <ripple/basics/chrono.h>
24 #include <ripple/beast/utility/Journal.h>
78 template <
class Rep,
class Period,
class Seq>
85 assert(ledgerSeq != Seq{0});
97 return previousResolution;
101 if (!previousAgree &&
117 return previousResolution;
127 template <
class Clock,
class Duration,
class Rep,
class Period>
137 closeTime += (closeResolution / 2);
150 template <
class Clock,
class Duration,
class Rep,
class Period>
157 using namespace std::chrono_literals;
163 return std::max<time_point>(
std::chrono::time_point< Clock, Duration > roundCloseTime(std::chrono::time_point< Clock, Duration > closeTime, std::chrono::duration< Rep, Period > closeResolution)
Calculates the close time for a ledger, given a close time resolution.
constexpr auto decreaseLedgerTimeResolutionEvery
How often we decrease the close time resolution (in numbers of ledgers)
T time_since_epoch(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr auto increaseLedgerTimeResolutionEvery
How often we increase the close time resolution (in numbers of ledgers)
constexpr std::chrono::seconds ledgerPossibleTimeResolutions[]
Possible ledger close time resolutions.
constexpr auto ledgerGenesisTimeResolution
Close time resolution in genesis ledger.
std::chrono::duration< Rep, Period > getNextLedgerTimeResolution(std::chrono::duration< Rep, Period > previousResolution, bool previousAgree, Seq ledgerSeq)
Calculates the close time resolution for the specified ledger.
constexpr auto ledgerDefaultTimeResolution
Initial resolution of ledger close time.
std::chrono::time_point< Clock, Duration > effCloseTime(std::chrono::time_point< Clock, Duration > closeTime, std::chrono::duration< Rep, Period > resolution, std::chrono::time_point< Clock, Duration > priorCloseTime)
Calculate the effective ledger close time.