mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-06-02 23:42:33 +02:00
[util] Introduce a SetMockTime that takes chrono time
This commit is contained in:
parent
df6a5fc1df
commit
47a7a1687d
@ -53,6 +53,11 @@ void SetMockTime(int64_t nMockTimeIn)
|
|||||||
nMockTime.store(nMockTimeIn, std::memory_order_relaxed);
|
nMockTime.store(nMockTimeIn, std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetMockTime(std::chrono::seconds mock_time_in)
|
||||||
|
{
|
||||||
|
nMockTime.store(mock_time_in.count(), std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
|
||||||
std::chrono::seconds GetMockTime()
|
std::chrono::seconds GetMockTime()
|
||||||
{
|
{
|
||||||
return std::chrono::seconds(nMockTime.load(std::memory_order_relaxed));
|
return std::chrono::seconds(nMockTime.load(std::memory_order_relaxed));
|
||||||
|
@ -46,6 +46,9 @@ int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable
|
|||||||
/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */
|
/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */
|
||||||
void SetMockTime(int64_t nMockTimeIn);
|
void SetMockTime(int64_t nMockTimeIn);
|
||||||
|
|
||||||
|
/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */
|
||||||
|
void SetMockTime(std::chrono::seconds mock_time_in);
|
||||||
|
|
||||||
/** For testing */
|
/** For testing */
|
||||||
std::chrono::seconds GetMockTime();
|
std::chrono::seconds GetMockTime();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user