forked from pool/libqt5-qtbase
c56a9d1b0f
- Added QMimeDatabase-use-QElapsedTimer.patch: reduces the number of syscalls greatly, by avoiding the timezone conversion every time; massively improves kbuildsycoca5 speed - Fix the suse_version condition checks - treat Leap equally as 13.2 wrt which system libs shall be used OBS-URL: https://build.opensuse.org/request/show/319198 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=44
57 lines
1.9 KiB
Diff
57 lines
1.9 KiB
Diff
From 3426ce9b8e62e8d76db0d9cc2899113c0c3cb073 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 1/1] 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 cca9a40b9f28e1b45a6e5e0172f512c5880a10d6..9f6bdb30981f4f236ef422cfd16f6c1cd38c643f 100644
|
|
--- a/src/corelib/mimetypes/qmimeprovider.cpp
|
|
+++ b/src/corelib/mimetypes/qmimeprovider.cpp
|
|
@@ -77,10 +77,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)
|
|
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 027fddd2c81ddb52fb3c383edfeda3a03f9ccaac..e4bc55a1a2deb5f4d030f451dd97729c2ca95bb8 100644
|
|
--- a/src/corelib/mimetypes/qmimeprovider_p.h
|
|
+++ b/src/corelib/mimetypes/qmimeprovider_p.h
|
|
@@ -48,6 +48,7 @@
|
|
#include <QtCore/qdatetime.h>
|
|
#include "qmimedatabase_p.h"
|
|
#include <QtCore/qset.h>
|
|
+#include <QtCore/qelapsedtimer.h>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
@@ -74,7 +75,7 @@ public:
|
|
QMimeDatabasePrivate *m_db;
|
|
protected:
|
|
bool shouldCheck();
|
|
- QDateTime m_lastCheck;
|
|
+ QElapsedTimer m_lastCheck;
|
|
};
|
|
|
|
/*
|
|
--
|
|
2.4.6
|
|
|