summaryrefslogtreecommitdiffstats
path: root/src/assistant/help/qhelpcollectionhandler.cpp
diff options
context:
space:
mode:
authorKai Pastor <dg0yt@darc.de>2020-10-15 07:48:49 +0200
committerDmitry Shachnev <mitya57@gmail.com>2020-12-01 15:29:32 +0300
commitb463cd691b533ee31d602b2226b90d3c528b6a94 (patch)
treecd87a7dc465e16a86a45e431889792fad02d18e6 /src/assistant/help/qhelpcollectionhandler.cpp
parent92d9f405e420b4af273ad13197a47470689a2f49 (diff)
Clamp registered collection time-stamp to SOURCE_DATE_EPOCH if set
Task-number: QTBUG-62697 Pick-to: 6.0 5.15 Change-Id: I73cc41db9c57d050783e963896f9696c294126c3 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'src/assistant/help/qhelpcollectionhandler.cpp')
-rw-r--r--src/assistant/help/qhelpcollectionhandler.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/assistant/help/qhelpcollectionhandler.cpp b/src/assistant/help/qhelpcollectionhandler.cpp
index 57ab8e329..595cc0e29 100644
--- a/src/assistant/help/qhelpcollectionhandler.cpp
+++ b/src/assistant/help/qhelpcollectionhandler.cpp
@@ -2197,7 +2197,15 @@ bool QHelpCollectionHandler::registerIndexTable(const QHelpDBReader::IndexTable
m_query->addBindValue(fileName);
const QFileInfo fi(absoluteDocPath(fileName));
m_query->addBindValue(fi.size());
- m_query->addBindValue(fi.lastModified().toString(Qt::ISODate));
+ QDateTime lastModified = fi.lastModified();
+ if (qEnvironmentVariableIsSet("SOURCE_DATE_EPOCH")) {
+ const QString sourceDateEpochStr = qEnvironmentVariable("SOURCE_DATE_EPOCH");
+ bool ok;
+ const qlonglong sourceDateEpoch = sourceDateEpochStr.toLongLong(&ok);
+ if (ok && sourceDateEpoch < lastModified.toSecsSinceEpoch())
+ lastModified.setSecsSinceEpoch(sourceDateEpoch);
+ }
+ m_query->addBindValue(lastModified.toString(Qt::ISODate));
if (!m_query->exec())
return false;