[Git][reproducible-builds/reproducible-website][master] source-date-epoch: document alternative python snippet
Holger Levsen
gitlab at salsa.debian.org
Thu Jul 11 11:28:35 UTC 2019
Holger Levsen pushed to branch master at Reproducible Builds / reproducible-website
Commits:
ff02986c by Bernhard M. Wiedemann at 2019-07-11T11:28:19Z
source-date-epoch: document alternative python snippet
This works as drop-in replacement for time.strftime("%Y-%m-%d")
Signed-off-by: Holger Levsen <holger at layer-acht.org>
- - - - -
1 changed file:
- _docs/source-date-epoch.md
Changes:
=====================================
_docs/source-date-epoch.md
=====================================
@@ -87,6 +87,14 @@ import datetime
build_date = datetime.datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time())))
```
+or with less imports:
+
+```
+import os
+import time
+date_str = time.strftime("%Y-%m-%d", time.gmtime(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))))
+```
+
### Bash / POSIX shell
For GNU systems:
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/commit/ff02986c0fb73cbd46333b02ca3c928580a6e469
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/commit/ff02986c0fb73cbd46333b02ca3c928580a6e469
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20190711/48a11f02/attachment.html>
More information about the rb-commits
mailing list