05c147f1a9
Update to 5.5.0 OBS-URL: https://build.opensuse.org/request/show/324146 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=46
56 lines
1.7 KiB
Diff
56 lines
1.7 KiB
Diff
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
|