diff options
author | MarcoFalke <falke.marco@gmail.com> | 2022-04-08 17:37:18 +0200 |
---|---|---|
committer | MacroFake <falke.marco@gmail.com> | 2022-05-18 18:58:05 +0200 |
commit | fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb (patch) | |
tree | e718750f28eeb8a8775ce228059d561a03bd84f4 /src/test/util_tests.cpp | |
parent | 002411dc53753b52fef645484258e8baf41585a1 (diff) | |
download | bitcoin-fa305fd92c0a5a91831be3ccec0a5ef962a5fbcb.tar.xz |
Add mockable clock type and TicksSinceEpoch helper
Diffstat (limited to 'src/test/util_tests.cpp')
-rw-r--r-- | src/test/util_tests.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 882ad7d424..eeecbe5ea9 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -1488,8 +1488,12 @@ BOOST_AUTO_TEST_CASE(util_time_GetTime) for (const auto& num_sleep : {0ms, 1ms}) { UninterruptibleSleep(num_sleep); BOOST_CHECK_EQUAL(111, GetTime()); // Deprecated time getter + BOOST_CHECK_EQUAL(111, Now<NodeSeconds>().time_since_epoch().count()); + BOOST_CHECK_EQUAL(111, TicksSinceEpoch<std::chrono::seconds>(NodeClock::now())); + BOOST_CHECK_EQUAL(111, TicksSinceEpoch<SecondsDouble>(Now<NodeSeconds>())); BOOST_CHECK_EQUAL(111, GetTime<std::chrono::seconds>().count()); BOOST_CHECK_EQUAL(111000, GetTime<std::chrono::milliseconds>().count()); + BOOST_CHECK_EQUAL(111000, TicksSinceEpoch<std::chrono::milliseconds>(NodeClock::now())); BOOST_CHECK_EQUAL(111000000, GetTime<std::chrono::microseconds>().count()); } |