Commit 0187b2bc authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

notifiers: Prefer chrono literals to express time

For readability and because it's less error-prone.
parent ae3dda5e
......@@ -14,6 +14,8 @@
#include <QTimer>
#include <QtConcurrentRun>
using namespace std::chrono_literals;
static void installationChanged(GFileMonitor *monitor, GFile *child, GFile *other_file, GFileMonitorEvent event_type, gpointer self)
{
Q_UNUSED(monitor);
......@@ -36,7 +38,7 @@ FlatpakNotifier::FlatpakNotifier(QObject *parent)
, m_cancellable(g_cancellable_new())
{
QTimer *dailyCheck = new QTimer(this);
dailyCheck->setInterval(24 * 60 * 60 * 1000); // refresh at least once every day
dailyCheck->setInterval(24h); // refresh at least once every day
connect(dailyCheck, &QTimer::timeout, this, &FlatpakNotifier::recheckSystemUpdateNeeded);
}
......
......@@ -26,6 +26,8 @@
#include "libdiscover_backend_debug.h"
#include "pk-offline-private.h"
using namespace std::chrono_literals;
PackageKitNotifier::PackageKitNotifier(QObject *parent)
: BackendNotifierModule(parent)
, m_securityUpdates(0)
......@@ -40,7 +42,7 @@ PackageKitNotifier::PackageKitNotifier(QObject *parent)
});
// Check if there's packages after 5'
QTimer::singleShot(5 * 60 * 1000, this, &PackageKitNotifier::refreshDatabase);
QTimer::singleShot(5min, this, &PackageKitNotifier::refreshDatabase);
QTimer *regularCheck = new QTimer(this);
connect(regularCheck, &QTimer::timeout, this, &PackageKitNotifier::refreshDatabase);
......@@ -51,7 +53,7 @@ PackageKitNotifier::PackageKitNotifier(QObject *parent)
bool ok;
const int days = value.toInt(&ok);
if (!ok || days == 0) {
regularCheck->setInterval(24 * 60 * 60 * 1000); // refresh at least once every day
regularCheck->setInterval(24h); // refresh at least once every day
regularCheck->start();
if (!value.isEmpty())
qWarning() << "couldn't understand value for timer:" << value;
......@@ -61,11 +63,11 @@ PackageKitNotifier::PackageKitNotifier(QObject *parent)
// https://wiki.debian.org/UnattendedUpgrades
});
} else {
regularCheck->setInterval(24 * 60 * 60 * 1000); // refresh at least once every day
regularCheck->setInterval(24h); // refresh at least once every day
regularCheck->start();
}
QTimer::singleShot(3000, this, &PackageKitNotifier::checkOfflineUpdates);
QTimer::singleShot(3s, this, &PackageKitNotifier::checkOfflineUpdates);
m_recheckTimer = new QTimer(this);
m_recheckTimer->setInterval(200);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment