Wallet: fix different signedness comparison (-Werror=sign-compare)

Co-authored-by: Bertrand Jacquin <bertrand@jacquin.bzh>
This commit is contained in:
xiphon 2020-10-18 20:48:44 +00:00
parent cb1f3ad0ce
commit 6ee5effc15

View file

@ -1116,8 +1116,8 @@ Wallet::~Wallet()
void Wallet::startRefreshThread() void Wallet::startRefreshThread()
{ {
const auto future = m_scheduler.run([this] { const auto future = m_scheduler.run([this] {
static constexpr const size_t refreshIntervalSec = 10; constexpr const std::chrono::seconds refreshInterval{10};
static constexpr const size_t intervalResolutionMs = 100; constexpr const std::chrono::milliseconds intervalResolution{100};
auto last = std::chrono::steady_clock::now(); auto last = std::chrono::steady_clock::now();
while (!m_scheduler.stopping()) while (!m_scheduler.stopping())
@ -1125,15 +1125,15 @@ void Wallet::startRefreshThread()
if (m_refreshEnabled) if (m_refreshEnabled)
{ {
const auto now = std::chrono::steady_clock::now(); const auto now = std::chrono::steady_clock::now();
const auto elapsed = std::chrono::duration_cast<std::chrono::seconds>(now - last).count(); const auto elapsed = now - last;
if (elapsed >= refreshIntervalSec) if (elapsed >= refreshInterval)
{ {
refresh(false); refresh(false);
last = std::chrono::steady_clock::now(); last = std::chrono::steady_clock::now();
} }
} }
std::this_thread::sleep_for(std::chrono::milliseconds(intervalResolutionMs)); std::this_thread::sleep_for(intervalResolution);
} }
}); });
if (!future.first) if (!future.first)