From 1d7fd423000e1916f3db9745e20d60692403cb05 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 6 Aug 2020 22:10:32 +0200 Subject: [PATCH] tools/firmware-utils: use UTC for image timestamps By using localtime() to determine the timestamp that goes into factory images, the resulting image depends on the timezone of the build system. Use gmtime() instead, which results in more reproducible images. Signed-off-by: Sander Vanheule --- Makefile | 2 +- src/addpattern.c | 2 +- src/tplink-safeloader.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ee0ef3a..4fcda7e 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME := firmware-utils -PKG_RELEASE := 1 +PKG_RELEASE := 2 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/kernel.mk diff --git a/src/addpattern.c b/src/addpattern.c index 9bc4865..9791527 100644 --- a/src/addpattern.c +++ b/src/addpattern.c @@ -296,7 +296,7 @@ int main(int argc, char **argv) return EXIT_FAILURE; } - ptm = localtime(&t); + ptm = gmtime(&t); if (3 != sscanf(version, "v%d.%d.%d", &v0, &v1, &v2)) { fprintf(stderr, "bad version string \"%s\"\n", version); diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index a5f3ced..0af1fe4 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -2079,7 +2079,7 @@ static struct image_partition_entry make_soft_version(uint32_t rev) { else if (time(&t) == (time_t)(-1)) error(1, errno, "time"); - struct tm *tm = localtime(&t); + struct tm *tm = gmtime(&t); s->magic = htonl(0x0000000c); s->zero = 0; -- 2.30.2