[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#875847: Patch to fix ".qhc files not reproducible"



This patch fixes the creation of the offending timestamp, by clamping to SOURCE_DATE_EPOCH as specified.

I also left a link to this Debian bug in Qt's code review for the offending change.

Best regards,
Kai
Clamp registered collection time-stamp to SOURCE_DATE_EPOCH if set.
--- a/src/assistant/help/qhelpcollectionhandler.cpp
+++ b/src/assistant/help/qhelpcollectionhandler.cpp
@@ -2197,7 +2197,14 @@
     m_query->addBindValue(fileName);
     const QFileInfo fi(absoluteDocPath(fileName));
     m_query->addBindValue(fi.size());
-    m_query->addBindValue(fi.lastModified().toString(Qt::ISODate));
+    QDateTime last_modified = fi.lastModified();
+    if (qEnvironmentVariableIsSet("SOURCE_DATE_EPOCH"))
+    {
+        qint64 source_date_epoch = qEnvironmentVariableIntValue("SOURCE_DATE_EPOCH");
+        if (source_date_epoch < last_modified.toSecsSinceEpoch())
+            last_modified.setSecsSinceEpoch(qEnvironmentVariableIntValue("SOURCE_DATE_EPOCH"));
+    }
+    m_query->addBindValue(last_modified.toString(Qt::ISODate));
     if (!m_query->exec())
         return false;
 

Reply to: