From 90228c4d2626e995de3a62c0c46e8bad070deaad Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Sat, 24 Jul 2021 18:13:49 +0200 Subject: io_archive: Use SOURCE_DATE_EPOCH for meta files instead of current time [TT: minor stylistic changes] --- src/common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/common.c') diff --git a/src/common.c b/src/common.c index 14a56a3..580e6d5 100644 --- a/src/common.c +++ b/src/common.c @@ -40,3 +40,18 @@ void *apk_array_resize(void *array, size_t new_size, size_t elem_size) return tmp; } + +time_t apk_get_build_time(void) +{ + static int initialized = 0; + static time_t timestamp = 0; + char *source_date_epoch; + + if (initialized) return timestamp; + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (source_date_epoch && *source_date_epoch) + timestamp = strtoull(source_date_epoch, NULL, 10); + else timestamp = time(NULL); + initialized = 1; + return timestamp; +} -- cgit v1.2.3-70-g09d2