mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
refactor, qt: Use std::chrono for MODEL_UPDATE_DELAY constant
This commit is contained in:
parent
2e01b69860
commit
33d520ac53
2 changed files with 7 additions and 3 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <netbase.h>
|
#include <netbase.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/threadnames.h>
|
#include <util/threadnames.h>
|
||||||
|
#include <util/time.h>
|
||||||
#include <validation.h>
|
#include <validation.h>
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
@ -288,7 +289,7 @@ static void BlockTipChanged(ClientModel* clientmodel, SynchronizationState sync_
|
||||||
const bool throttle = (sync_state != SynchronizationState::POST_INIT && !fHeader) || sync_state == SynchronizationState::INIT_REINDEX;
|
const bool throttle = (sync_state != SynchronizationState::POST_INIT && !fHeader) || sync_state == SynchronizationState::INIT_REINDEX;
|
||||||
const int64_t now = throttle ? GetTimeMillis() : 0;
|
const int64_t now = throttle ? GetTimeMillis() : 0;
|
||||||
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
|
int64_t& nLastUpdateNotification = fHeader ? nLastHeaderTipUpdateNotification : nLastBlockTipUpdateNotification;
|
||||||
if (throttle && now < nLastUpdateNotification + MODEL_UPDATE_DELAY) {
|
if (throttle && now < nLastUpdateNotification + count_milliseconds(MODEL_UPDATE_DELAY)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,10 +5,13 @@
|
||||||
#ifndef BITCOIN_QT_GUICONSTANTS_H
|
#ifndef BITCOIN_QT_GUICONSTANTS_H
|
||||||
#define BITCOIN_QT_GUICONSTANTS_H
|
#define BITCOIN_QT_GUICONSTANTS_H
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
/* Milliseconds between model updates */
|
using namespace std::chrono_literals;
|
||||||
static const int MODEL_UPDATE_DELAY = 250;
|
|
||||||
|
/* A delay between model updates */
|
||||||
|
static constexpr auto MODEL_UPDATE_DELAY{250ms};
|
||||||
|
|
||||||
/* AskPassphraseDialog -- Maximum passphrase length */
|
/* AskPassphraseDialog -- Maximum passphrase length */
|
||||||
static const int MAX_PASSPHRASE_SIZE = 1024;
|
static const int MAX_PASSPHRASE_SIZE = 1024;
|
||||||
|
|
Loading…
Add table
Reference in a new issue