From b5701ca5a265bc4ee8269b1abcbdf605e5e646ba Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sat, 17 Dec 2022 11:49:20 +0200 Subject: [PATCH] RCCFileInfo: get lastModified file time in UTC directly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are time stamps, and they use toMsecsSinceEpoch(), no point getting the time in Local time zone then converting it. Change-Id: I2db2db5f9ebc062e65514a592fa7fa00cf1d179d Reviewed-by: Kai Köhne Reviewed-by: Thiago Macieira --- src/tools/rcc/rcc.cpp | 2 +- tests/auto/tools/rcc/tst_rcc.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 3331ffbb9d..a6f3951960 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -202,7 +202,7 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) if (lib.formatVersion() >= 2) { // last modified time stamp - const QDateTime lastModified = m_fileInfo.lastModified(); + const QDateTime lastModified = m_fileInfo.lastModified(QTimeZone::UTC); quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0); static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong(); if (sourceDate != 0) diff --git a/tests/auto/tools/rcc/tst_rcc.cpp b/tests/auto/tools/rcc/tst_rcc.cpp index ad13cc2eeb..1ed3b5f2cd 100644 --- a/tests/auto/tools/rcc/tst_rcc.cpp +++ b/tests/auto/tools/rcc/tst_rcc.cpp @@ -114,7 +114,7 @@ static QString doCompare(const QStringList &actual, const QStringList &expected, ba.append("File " + fi.absoluteFilePath().toUtf8() + " does not exist!"); break; } - const quint64 timeStamp = quint64(fi.lastModified().toMSecsSinceEpoch()); + const quint64 timeStamp = quint64(fi.lastModified(QTimeZone::UTC).toMSecsSinceEpoch()); expectedLine.clear(); for (int shift = 56; shift >= 0; shift -= 8) { expectedLine.append(QLatin1String("0x"));