Skip to content

Commit fa6b45f

Browse files
author
MarcoFalke
committed
Add SetMockTime for time_point types
1 parent b7e9dc8 commit fa6b45f

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/util/time.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ NodeClock::time_point NodeClock::now() noexcept
3838
};
3939

4040
void SetMockTime(int64_t nMockTimeIn) { SetMockTime(std::chrono::seconds{nMockTimeIn}); }
41+
void SetMockTime(std::chrono::time_point<NodeClock, std::chrono::seconds> mock) { SetMockTime(mock.time_since_epoch()); }
4142
void SetMockTime(std::chrono::seconds mock_time_in)
4243
{
4344
Assert(mock_time_in >= 0s);

src/util/time.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ void SetMockTime(int64_t nMockTimeIn);
107107

108108
/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */
109109
void SetMockTime(std::chrono::seconds mock_time_in);
110+
void SetMockTime(std::chrono::time_point<NodeClock, std::chrono::seconds> mock);
110111

111112
/** For testing */
112113
std::chrono::seconds GetMockTime();

0 commit comments

Comments
 (0)