From 41867c25f8438eb34dddba9d058e32c73638b4f5 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sat, 17 Dec 2022 13:09:33 +0200 Subject: Use QFileInfo's file times in UTC for file timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is inherently faster than getting it in UTC from the underlying native API stat call, then converting it to the Local Time Zone just to compare them. The same goes for any use-case where you get a QDateTime then the first thing you do is call t.to{Msec,Secs}SinceEpoch(). Change-Id: Ic13bcfd99b937c9f10f102ea7741832950a553c6 Reviewed-by: Thiago Macieira Reviewed-by: Kai Köhne --- tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp') diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp index 8c6bc73cdf..4bfb305ef0 100644 --- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp +++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp @@ -886,7 +886,7 @@ static bool waitAndRunUpdateMimeDatabase(const QString &path) QFileInfo mimeCacheInfo(path + QString::fromLatin1("/mime.cache")); if (mimeCacheInfo.exists()) { // Wait until the beginning of the next second - while (mimeCacheInfo.lastModified().secsTo(QDateTime::currentDateTime()) == 0) { + while (mimeCacheInfo.lastModified(QTimeZone::UTC).secsTo(QDateTime::currentDateTime()) == 0) { QTest::qSleep(200); } } -- cgit v1.2.3