diff options
Diffstat (limited to 'romfs/tools/create_crc.c')
-rw-r--r-- | romfs/tools/create_crc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/romfs/tools/create_crc.c b/romfs/tools/create_crc.c index abc373b..4a30e48 100644 --- a/romfs/tools/create_crc.c +++ b/romfs/tools/create_crc.c @@ -95,7 +95,13 @@ createHeaderImage(int notime) if (!notime) { /* read time and write it into data stream */ - if ((caltime = time(NULL)) == -1) { + char *source_date_epoch; + /* This assumes that (if set) 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 || + (caltime = (time_t)strtoll(source_date_epoch, NULL, 10)) <= 0) + caltime = time(NULL); + if (caltime == -1) { printf("time error\n"); } if ((tm = localtime(&caltime)) == NULL) { |