20#ifndef RIPPLE_APP_LEDGER_LEDGERTIMING_H_INCLUDED
21#define RIPPLE_APP_LEDGER_LEDGERTIMING_H_INCLUDED
23#include <xrpl/basics/chrono.h>
24#include <xrpl/beast/utility/Journal.h>
78template <
class Rep,
class Period,
class Seq>
87 "ripple:getNextLedgerTimeResolution : valid ledger sequence");
97 "ripple:getNextLedgerTimeResolution : found time resolution");
101 return previousResolution;
105 if (!previousAgree &&
121 return previousResolution;
131template <
class Clock,
class Duration,
class Rep,
class Period>
141 closeTime += (closeResolution / 2);
154template <
class Clock,
class Duration,
class Rep,
class Period>
161 using namespace std::chrono_literals;
167 return std::max<time_point>(
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
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.
auto constexpr decreaseLedgerTimeResolutionEvery
How often we decrease the close time resolution (in numbers of ledgers)
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.
auto constexpr ledgerDefaultTimeResolution
Initial resolution of ledger close time.
auto constexpr ledgerGenesisTimeResolution
Close time resolution in genesis ledger.
std::chrono::seconds constexpr ledgerPossibleTimeResolutions[]
Possible ledger close time resolutions.
auto constexpr increaseLedgerTimeResolutionEvery
How often we increase the close time resolution (in numbers of ledgers)
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.
T time_since_epoch(T... args)