From: =?utf-8?b?Su+/vXLvv71teSBCb2JiaW8=?= <lunar@debian.org>
Date: Mon, 27 Jun 2022 15:35:39 +0800
Subject: add support for SOURCE_DATE_EPOCH

Allow one to override the recorded build time by setting SOURCE_DATE_EPOCH
in the environment. More details can be found on:
https://reproducible-builds.org/specs/source-date-epoch/
---
 openpgm/pgm/version_generator.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/openpgm/pgm/version_generator.py b/openpgm/pgm/version_generator.py
index 7a93cad..a205d4b 100755
--- a/openpgm/pgm/version_generator.py
+++ b/openpgm/pgm/version_generator.py
@@ -4,8 +4,9 @@ import os
 import platform
 import time
 
-build_date = time.strftime ("%Y-%m-%d")
-build_time = time.strftime ("%H:%M:%S")
+timestamp = time.gmtime (int (os.getenv ('SOURCE_DATE_EPOCH', time.time ())))
+build_date = time.strftime ("%Y-%m-%d", timestamp)
+build_time = time.strftime ("%H:%M:%S", timestamp)
 build_rev = filter (str.isdigit, "$Revision: 1487 $")
 
 print """
