Description: Suppress test-suite elapsed-time report under SOURCE_DATE_EPOCH

 The quantlib-test-suite log records a "Tests completed in ..." line whose
 duration is not reproducible between builds. When the package is built
 reproducibly, dpkg-buildpackage sets SOURCE_DATE_EPOCH in the build
 environment; in that case skip the elapsed-time report so that the packaged
 test-suite log is bit-for-bit reproducible. In ordinary (non-reproducible)
 builds the timing report is unchanged.

Author: Dirk Eddelbuettel <edd@debian.org>
Last-Update: 2026-10-28
---
 test-suite/quantlibglobalfixture.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/test-suite/quantlibglobalfixture.cpp b/test-suite/quantlibglobalfixture.cpp
index 8a7c4be..0c4172e 100644
--- a/test-suite/quantlibglobalfixture.cpp
+++ b/test-suite/quantlibglobalfixture.cpp
@@ -25,6 +25,7 @@
 #include <ql/version.hpp>
 #include <iostream>
 #include <iomanip>
+#include <cstdlib>
 
 using namespace boost::unit_test;
 
@@ -122,6 +123,12 @@
 }
 
 QuantLibGlobalFixture::~QuantLibGlobalFixture(){
+    // SOURCE_DATE_EPOCH is set by dpkg-buildpackage / the reproducible-builds
+    // infrastructure. The elapsed time is not deterministic, so skip the
+    // report to keep the packaged test-suite log bit-for-bit reproducible.
+    if (std::getenv("SOURCE_DATE_EPOCH") != nullptr)
+        return;
+
     stop = std::chrono::steady_clock::now();
 
     double seconds = std::chrono::duration_cast<std::chrono::milliseconds>(stop - start).count() * 1e-3;
