Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.1:Staging:C
libqt5-qtbase
QMimeDatabase-use-QElapsedTimer.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File QMimeDatabase-use-QElapsedTimer.patch of Package libqt5-qtbase
From 849aebc0ce344dedc91035bf4bcc7ccb4c15ffe4 Mon Sep 17 00:00:00 2001 From: David Faure <david.faure@kdab.com> Date: Mon, 27 Jul 2015 00:22:11 +0200 Subject: [PATCH] QMimeDatabase: use QElapsedTimer instead of QDateTime::currentDateTime() This reduces the number of syscalls greatly, by avoiding the timezone conversion every time. Change-Id: I39a54def4b45f25c6e037ced6943b05ddc749c9d --- src/corelib/mimetypes/qmimeprovider.cpp | 5 ++--- src/corelib/mimetypes/qmimeprovider_p.h | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/mimetypes/qmimeprovider.cpp b/src/corelib/mimetypes/qmimeprovider.cpp index 7342a5c..3914710 100644 --- a/src/corelib/mimetypes/qmimeprovider.cpp +++ b/src/corelib/mimetypes/qmimeprovider.cpp @@ -79,10 +79,9 @@ Q_CORE_EXPORT int qmime_secondsBetweenChecks = 5; // exported for the unit test bool QMimeProviderBase::shouldCheck() { - const QDateTime now = QDateTime::currentDateTime(); - if (m_lastCheck.isValid() && m_lastCheck.secsTo(now) < qmime_secondsBetweenChecks) + if (m_lastCheck.isValid() && m_lastCheck.elapsed() < qmime_secondsBetweenChecks * 1000) return false; - m_lastCheck = now; + m_lastCheck.start(); return true; } diff --git a/src/corelib/mimetypes/qmimeprovider_p.h b/src/corelib/mimetypes/qmimeprovider_p.h index 5a89ac2..eaf9594 100644 --- a/src/corelib/mimetypes/qmimeprovider_p.h +++ b/src/corelib/mimetypes/qmimeprovider_p.h @@ -51,6 +51,7 @@ #include <QtCore/qdatetime.h> #include <QtCore/qset.h> +#include <QtCore/qelapsedtimer.h> QT_BEGIN_NAMESPACE @@ -77,7 +78,7 @@ public: QMimeDatabasePrivate *m_db; protected: bool shouldCheck(); - QDateTime m_lastCheck; + QElapsedTimer m_lastCheck; }; /* -- 2.3.5
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor