Message ID | 1443802311-31054-1-git-send-email-vagrant@debian.org |
---|---|
State | Accepted |
Delegated to: | Tom Rini |
Headers | show |
Le vendredi 02 octobre 2015 à 09:11 -0700, Vagrant Cascadian a écrit : > When building with SOURCE_DATE_EPOCH set, avoid use of mktime in > default_image.c, which converts the timestamp into localtime. This > causes variation based on timezone when building u-boot.img and > u-boot-sunxi-with-spl.bin targets. I have tested this with the Cubieboard2_defconfig when setting SOURCE_DATE_EPOCH and changing TZ. This corrects the problem in the way I suggested, so this is: Tested-by: Paul Kocialkowski <contact@paulk.fr> Acked-by: Paul Kocialkowski <contact@paulk.fr> Thanks! > Signed-off-by: Vagrant Cascadian <vagrant@debian.org> > --- > > tools/default_image.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/tools/default_image.c b/tools/default_image.c > index 18940af..3ed7014 100644 > --- a/tools/default_image.c > +++ b/tools/default_image.c > @@ -89,7 +89,6 @@ static void image_set_header(void *ptr, struct stat > *sbuf, int ifd, > { > uint32_t checksum; > char *source_date_epoch; > - struct tm *time_universal; > time_t time; > > image_header_t * hdr = (image_header_t *)ptr; > @@ -103,13 +102,10 @@ static void image_set_header(void *ptr, struct > stat *sbuf, int ifd, > if (source_date_epoch != NULL) { > time = (time_t) strtol(source_date_epoch, NULL, 10); > > - time_universal = gmtime(&time); > - if (time_universal == NULL) { > + if (gmtime(&time) == NULL) { > fprintf(stderr, "%s: SOURCE_DATE_EPOCH is > not valid\n", > __func__); > time = 0; > - } else { > - time = mktime(time_universal); > } > } else { > time = sbuf->st_mtime;
On Fri, Oct 02, 2015 at 09:11:51AM -0700, Vagrant Cascadian wrote: > When building with SOURCE_DATE_EPOCH set, avoid use of mktime in > default_image.c, which converts the timestamp into localtime. This > causes variation based on timezone when building u-boot.img and > u-boot-sunxi-with-spl.bin targets. > > Signed-off-by: Vagrant Cascadian <vagrant@debian.org> > Tested-by: Paul Kocialkowski <contact@paulk.fr> > Acked-by: Paul Kocialkowski <contact@paulk.fr> Applied to u-boot/master, thanks!
diff --git a/tools/default_image.c b/tools/default_image.c index 18940af..3ed7014 100644 --- a/tools/default_image.c +++ b/tools/default_image.c @@ -89,7 +89,6 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, { uint32_t checksum; char *source_date_epoch; - struct tm *time_universal; time_t time; image_header_t * hdr = (image_header_t *)ptr; @@ -103,13 +102,10 @@ static void image_set_header(void *ptr, struct stat *sbuf, int ifd, if (source_date_epoch != NULL) { time = (time_t) strtol(source_date_epoch, NULL, 10); - time_universal = gmtime(&time); - if (time_universal == NULL) { + if (gmtime(&time) == NULL) { fprintf(stderr, "%s: SOURCE_DATE_EPOCH is not valid\n", __func__); time = 0; - } else { - time = mktime(time_universal); } } else { time = sbuf->st_mtime;
When building with SOURCE_DATE_EPOCH set, avoid use of mktime in default_image.c, which converts the timestamp into localtime. This causes variation based on timezone when building u-boot.img and u-boot-sunxi-with-spl.bin targets. Signed-off-by: Vagrant Cascadian <vagrant@debian.org> --- tools/default_image.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)