QSettings: get file timestamps in UTC directly

These are timestamps, so UTC is all we need. This is faster than getting
the times in the Local Time Zone just to compare them.

Change-Id: I5ceebafea12a7015dce9e3c00d1b35f8da2afb1d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2022-12-17 12:04:26 +02:00
parent c3f8198d07
commit 39de5717de

View File

@ -1318,7 +1318,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
*/
if (readOnly && confFile->size > 0) {
QFileInfo fileInfo(confFile->name);
if (confFile->size == fileInfo.size() && confFile->timeStamp == fileInfo.lastModified())
if (confFile->size == fileInfo.size() && confFile->timeStamp == fileInfo.lastModified(QTimeZone::UTC))
return;
}
@ -1361,7 +1361,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
if (!readOnly)
mustReadFile = (confFile->size != fileInfo.size()
|| (confFile->size != 0 && confFile->timeStamp != fileInfo.lastModified()));
|| (confFile->size != 0 && confFile->timeStamp != fileInfo.lastModified(QTimeZone::UTC)));
if (mustReadFile) {
confFile->unparsedIniSections.clear();
@ -1407,7 +1407,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
}
confFile->size = fileInfo.size();
confFile->timeStamp = fileInfo.lastModified();
confFile->timeStamp = fileInfo.lastModified(QTimeZone::UTC);
}
/*
@ -1466,7 +1466,7 @@ void QConfFileSettingsPrivate::syncConfFile(QConfFile *confFile)
QFileInfo fileInfo(confFile->name);
confFile->size = fileInfo.size();
confFile->timeStamp = fileInfo.lastModified();
confFile->timeStamp = fileInfo.lastModified(QTimeZone::UTC);
// If we have created the file, apply the file perms
if (createFile) {