3#include <xrpl/basics/chrono.h>
4#include <xrpl/beast/utility/Journal.h>
58template <
class Rep,
class Period,
class Seq>
65 XRPL_ASSERT(ledgerSeq != Seq{0},
"xrpl::getNextLedgerTimeResolution : valid ledger sequence");
75 "xrpl::getNextLedgerTimeResolution : found time resolution");
79 return previousResolution;
97 return previousResolution;
107template <
class Clock,
class Duration,
class Rep,
class Period>
117 closeTime += (closeResolution / 2);
130template <
class Clock,
class Duration,
class Rep,
class Period>
137 using namespace std::chrono_literals;
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
constexpr auto kDecreaseLedgerTimeResolutionEvery
How often we decrease the close time resolution (in numbers of ledgers).
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.
constexpr auto kIncreaseLedgerTimeResolutionEvery
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.
constexpr std::chrono::seconds kLedgerPossibleTimeResolutions[]
Possible ledger close time resolutions.
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 kLedgerGenesisTimeResolution
Close time resolution in genesis ledger.
constexpr auto kLedgerDefaultTimeResolution
Initial resolution of ledger close time.
T time_since_epoch(T... args)