[Git][reproducible-builds/reproducible-website][master] source-date-epoch: make assumptions part of the code
Bernhard M. Wiedemann
gitlab at salsa.debian.org
Mon May 27 13:50:06 UTC 2019
Bernhard M. Wiedemann pushed to branch master at Reproducible Builds / reproducible-website
Commits:
e1efd6f6 by Bernhard M. Wiedemann at 2019-05-27T13:47:46Z
source-date-epoch: make assumptions part of the code
so that it has a higher likelyhood of being documented
in the target codebase
- - - - -
1 changed file:
- _docs/source-date-epoch.md
Changes:
=====================================
_docs/source-date-epoch.md
=====================================
@@ -190,13 +190,15 @@ if (source_date_epoch) {
build_time = gmtime(&now);
```
-If you want less verbose code and are happy with the assumption, that the variable will contain a correct, positive integer in the `time_t` range, you can use
+If you want less verbose code and are happy with the assumptions stated below, you can use
```
#include <stdlib.h>
time_t now;
char *source_date_epoch;
+/* This assumes that the SOURCE_DATE_EPOCH environment variable will contain
+ a correct, positive integer in the time_t range */
if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL ||
(now = (time_t)strtoll(source_date_epoch, NULL, 10)) <= 0)
time(&now);
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/commit/e1efd6f689336fd3ad913f2fd2450e131217a279
--
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-website/commit/e1efd6f689336fd3ad913f2fd2450e131217a279
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/20190527/3d10aef9/attachment.html>
More information about the rb-commits
mailing list