Add type-safe AdjustedTime() getter to timedata

Also, fix includes.

The getter will be used in a future commit.
This commit is contained in:
MarcoFalke 2022-03-24 21:21:58 +01:00 committed by MacroFake
parent fa5103a9f5
commit fa2ae373f3
No known key found for this signature in database
GPG key ID: CE2B75697E69A548
4 changed files with 8 additions and 3 deletions

View file

@ -12,6 +12,7 @@
#include <serialize.h>
#include <sync.h>
#include <uint256.h>
#include <timedata.h>
#include <cstdint>
#include <optional>

View file

@ -29,6 +29,7 @@
#include <scheduler.h>
#include <streams.h>
#include <sync.h>
#include <timedata.h>
#include <tinyformat.h>
#include <txmempool.h>
#include <txorphanage.h>

View file

@ -36,7 +36,6 @@
#include <shutdown.h>
#include <support/allocators/secure.h>
#include <sync.h>
#include <timedata.h>
#include <txmempool.h>
#include <uint256.h>
#include <univalue.h>

View file

@ -5,9 +5,12 @@
#ifndef BITCOIN_TIMEDATA_H
#define BITCOIN_TIMEDATA_H
#include <util/time.h>
#include <algorithm>
#include <assert.h>
#include <stdint.h>
#include <cassert>
#include <chrono>
#include <cstdint>
#include <vector>
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT = 70 * 60;
@ -73,6 +76,7 @@ public:
/** Functions to keep track of adjusted P2P time */
int64_t GetTimeOffset();
int64_t GetAdjustedTime();
inline NodeSeconds AdjustedTime() { return Now<NodeSeconds>() + std::chrono::seconds{GetTimeOffset()}; }
void AddTimeData(const CNetAddr& ip, int64_t nTime);
/**