mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-04-29 23:09:44 -04:00
Add type-safe AdjustedTime() getter to timedata
Also, fix includes. The getter will be used in a future commit.
This commit is contained in:
parent
fa5103a9f5
commit
fa2ae373f3
4 changed files with 8 additions and 3 deletions
|
@ -12,6 +12,7 @@
|
||||||
#include <serialize.h>
|
#include <serialize.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
|
#include <timedata.h>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <scheduler.h>
|
#include <scheduler.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
|
#include <timedata.h>
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <txorphanage.h>
|
#include <txorphanage.h>
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include <shutdown.h>
|
#include <shutdown.h>
|
||||||
#include <support/allocators/secure.h>
|
#include <support/allocators/secure.h>
|
||||||
#include <sync.h>
|
#include <sync.h>
|
||||||
#include <timedata.h>
|
|
||||||
#include <txmempool.h>
|
#include <txmempool.h>
|
||||||
#include <uint256.h>
|
#include <uint256.h>
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
|
|
|
@ -5,9 +5,12 @@
|
||||||
#ifndef BITCOIN_TIMEDATA_H
|
#ifndef BITCOIN_TIMEDATA_H
|
||||||
#define BITCOIN_TIMEDATA_H
|
#define BITCOIN_TIMEDATA_H
|
||||||
|
|
||||||
|
#include <util/time.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <assert.h>
|
#include <cassert>
|
||||||
#include <stdint.h>
|
#include <chrono>
|
||||||
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT = 70 * 60;
|
static const int64_t DEFAULT_MAX_TIME_ADJUSTMENT = 70 * 60;
|
||||||
|
@ -73,6 +76,7 @@ public:
|
||||||
/** Functions to keep track of adjusted P2P time */
|
/** Functions to keep track of adjusted P2P time */
|
||||||
int64_t GetTimeOffset();
|
int64_t GetTimeOffset();
|
||||||
int64_t GetAdjustedTime();
|
int64_t GetAdjustedTime();
|
||||||
|
inline NodeSeconds AdjustedTime() { return Now<NodeSeconds>() + std::chrono::seconds{GetTimeOffset()}; }
|
||||||
void AddTimeData(const CNetAddr& ip, int64_t nTime);
|
void AddTimeData(const CNetAddr& ip, int64_t nTime);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue