Skip to content

Commit fa1d804

Browse files
author
MarcoFalke
committed
test: Use steady clock in index tests
1 parent fa454dc commit fa1d804

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/test/blockfilter_index_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ BOOST_FIXTURE_TEST_CASE(blockfilter_index_initial_sync, BuildChainTestingSetup)
141141
BOOST_REQUIRE(filter_index.Start());
142142

143143
// Allow filter index to catch up with the block index.
144-
constexpr int64_t timeout_ms = 10 * 1000;
145-
int64_t time_start = GetTimeMillis();
144+
constexpr auto timeout{10s};
145+
const auto time_start{SteadyClock::now()};
146146
while (!filter_index.BlockUntilSyncedToCurrentChain()) {
147-
BOOST_REQUIRE(time_start + timeout_ms > GetTimeMillis());
147+
BOOST_REQUIRE(time_start + timeout > SteadyClock::now());
148148
UninterruptibleSleep(std::chrono::milliseconds{100});
149149
}
150150

src/test/txindex_tests.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ BOOST_FIXTURE_TEST_CASE(txindex_initial_sync, TestChain100Setup)
3232
BOOST_REQUIRE(txindex.Start());
3333

3434
// Allow tx index to catch up with the block index.
35-
constexpr int64_t timeout_ms = 10 * 1000;
36-
int64_t time_start = GetTimeMillis();
35+
constexpr auto timeout{10s};
36+
const auto time_start{SteadyClock::now()};
3737
while (!txindex.BlockUntilSyncedToCurrentChain()) {
38-
BOOST_REQUIRE(time_start + timeout_ms > GetTimeMillis());
38+
BOOST_REQUIRE(time_start + timeout > SteadyClock::now());
3939
UninterruptibleSleep(std::chrono::milliseconds{100});
4040
}
4141

0 commit comments

Comments
 (0)