Include timezone information in build
cover Include timezone information in build
Hi,
Recently an eagle-eyed tester pointed out to me that the build time reported in my u-boot build did not match the file timestamp on the server it was stored on. This is because at $dayjob we have a build farm with times set to UTC while the storage server was displaying the local time. In reality the times were the same but the timezones were not and there is no indication in the u-boot version about how to interpret the time.
This is my attempt to address the issue by defining U_BOOT_TZ along side U_BOOT_TIME and U_BOOT_DATE. I've kept the TZ portion separate because I thought there might some push pack on changing the version string. For my purposes I can display the TZ separately as long as it is defined by the build process. I've also elected to use %Z instead of %z as I feel that the timezone name is more friendly but that's just a personal preference so I wouldn't object to switching to the numeric representation if others feel strongly.
Chris Packham (1):
Makefile: Add U_BOOT_TZ and include in version
Makefile | 3 ++- include/version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.3.5
RFC PATCH 1/1 Makefile: Add U_BOOT_TZ and include in version
Define U_BOOT_TZ alongside U_BOOT_TIME and U_BOOT_DATE and use it to include the timezone in the version output.
---
Makefile | 3 ++- include/version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Makefile +2 -1
@@ -1230,7 +1230,8 @@ endef define filechk_timestamp.h (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ - LC_ALL=C date +'#define U_BOOT_TIME "%T"') + LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ + LC_ALL=C date +'#define U_BOOT_TZ "%Z"') endef $(version_h): include/config/uboot.release FORCE
include/version.h +1 -1
@@ -19,7 +19,7 @@#endif #define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME ")" CONFIG_IDENT_STRING + U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING#ifndef __ASSEMBLY__extern const char version_string[];
Signature · 1 line
2.3.5
RFC PATCH 1/1 Makefile: Add U_BOOT_TZ and include in version
Hi,
Quoted 38 lines · Chris Packham
Define
U_BOOT_TZalongsideU_BOOT_TIMEandU_BOOT_DATEand use it to include the timezone in the version output.Signed-off-by Chris Packham <[email protected]>---
Makefile | 3 ++- include/version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Makefile +2
-1@@ -1230,7 +1230,8 @@ endef define filechk_timestamp.h (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ - LC_ALL=C date +'#define U_BOOT_TIME "%T"') + LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ + LC_ALL=C date +'#define U_BOOT_TZ "%Z"') endef $(version_h): include/config/uboot.release FORCEinclude/version.h +1
-2@@ -19,7 +19,7 @@#endif #define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME ")" CONFIG_IDENT_STRING + U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING#ifndef __ASSEMBLY__extern const char version_string[]; --
Quoted 2 lines
2.3.5
Any feedback? I see I've now missed the merge window (sending the patch as RFC on the day before it closed didn't help, sorry about that). But is the general idea OK for when I re-submit when the next merge window opens?
Thanks,
Chris
RFC PATCH 1/1 Makefile: Add U_BOOT_TZ and include in version
Hi Chris,
Quoted 38 lines · Chris Packham
Hi,
Quoted 35 lines · Chris Packham
Define
U_BOOT_TZalongsideU_BOOT_TIMEandU_BOOT_DATEand use it to include the timezone in the version output.Signed-off-by Chris Packham <[email protected]>---
Makefile | 3 ++- include/version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)Makefile +2
-1@@ -1230,7 +1230,8 @@ endef define filechk_timestamp.h (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ - LC_ALL=C date +'#define U_BOOT_TIME "%T"') + LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ + LC_ALL=C date +'#define U_BOOT_TZ "%Z"') endef $(version_h): include/config/uboot.release FORCEinclude/version.h +1
-1@@ -19,7 +19,7 @@#endif #define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME ")" CONFIG_IDENT_STRING + U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING
Quoted 10 lines
Quoted 5 lines
include/version.h +0
-1#ifndef __ASSEMBLY__extern const char version_string[]; --2.3.5
Any feedback? I see I've now missed the merge window (sending the patch as RFC on the day before it closed didn't help, sorry about that). But is the general idea OK for when I re-submit when the next merge window opens?
Seems like a reasonable idea to me.
Regards,
Simon
PATCH v2 1/1 Makefile: Add U_BOOT_TZ and include in version
In reply to Chris PackhamDefine U_BOOT_TZ alongside U_BOOT_TIME and U_BOOT_DATE and use it to include the timezone in the version output.
---
As per feedback from Tom I've switched to '%z' so that any size increase as a result of the timezone information is constant.
Changes in v2:
- Switched to '%z'
- Rebased against 2017.07-rc1
Makefile | 3 ++- include/version.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
Makefile +2 -1
@@ -1230,7 +1230,8 @@ endef define filechk_timestamp.h (LC_ALL=C date +'#define U_BOOT_DATE "%b %d %C%y"'; \ - LC_ALL=C date +'#define U_BOOT_TIME "%T"') + LC_ALL=C date +'#define U_BOOT_TIME "%T"'; \ + LC_ALL=C date +'#define U_BOOT_TZ "%z"') endef $(version_h): include/config/uboot.release FORCE
include/version.h +1 -1
@@ -19,7 +19,7 @@#endif #define U_BOOT_VERSION_STRING U_BOOT_VERSION " (" U_BOOT_DATE " - " \ - U_BOOT_TIME ")" CONFIG_IDENT_STRING + U_BOOT_TIME " " U_BOOT_TZ ")" CONFIG_IDENT_STRING#ifndef __ASSEMBLY__extern const char version_string[];
Signature · 1 line
2.3.5
PATCH v2 1/1 Makefile: Add U_BOOT_TZ and include in version
Quoted 5 lines · Chris Packham
Define
U_BOOT_TZalongsideU_BOOT_TIMEandU_BOOT_DATEand use it to include the timezone in the version output.Acked-by Simon Glass <[email protected]>Signed-off-by Chris Packham <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150528/4147a183/attachment.sig>
cover Include timezone information in build
In reply to Chris PackhamQuoted 11 lines · Chris Packham
Hi,
Recently an eagle-eyed tester pointed out to me that the build time reported in my u-boot build did not match the file timestamp on the server it was stored on. This is because at $dayjob we have a build farm with times set to UTC while the storage server was displaying the local time. In reality the times were the same but the timezones were not and there is no indication in the u-boot version about how to interpret the time.
Quoted 8 lines
This is my attempt to address the issue by defining
U_BOOT_TZalong sideU_BOOT_TIMEandU_BOOT_DATE. I've kept the TZ portion separate because I thought there might some push pack on changing the version string. For my purposes I can display the TZ separately as long as it is defined by the build process. I've also elected to use %Z instead of %z as I feel that the timezone name is more friendly but that's just a personal preference so I wouldn't object to switching to the numeric representation if others feel strongly.
Concept is fine, I'd actually prefer %z so that the size increase is constant at least. Please do that in a non-RFC v2 and I'll pick it up, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150508/b8c86d16/attachment.sig>
cover Include timezone information in build
Hi Tom,
Quoted 21 lines · Tom Rini
Quoted 11 lines · Chris Packham
Hi,
Recently an eagle-eyed tester pointed out to me that the build time reported in my u-boot build did not match the file timestamp on the server it was stored on. This is because at $dayjob we have a build farm with times set to UTC while the storage server was displaying the local time. In reality the times were the same but the timezones were not and there is no indication in the u-boot version about how to interpret the time.
Quoted 8 lines
This is my attempt to address the issue by defining
U_BOOT_TZalong sideU_BOOT_TIMEandU_BOOT_DATE. I've kept the TZ portion separate because I thought there might some push pack on changing the version string. For my purposes I can display the TZ separately as long as it is defined by the build process. I've also elected to use %Z instead of %z as I feel that the timezone name is more friendly but that's just a personal preference so I wouldn't object to switching to the numeric representation if others feel strongly.
Quoted 3 lines
Concept is fine, I'd actually prefer %z so that the size increase is constant at least. Please do that in a non-RFC v2 and I'll pick it up, thanks!
v2 has been sent. After I sent it out of curiosity, I looked up the POSIX definition of date[1] and it looks as though '%z' is not part of the spec ('%Z' is). However '%z' is part of the POSIX definition of strfttime[2]. In practice I'm not sure how much it matters. I know the GNU date command supports it and it looks like the freebsd one also does.
I'm not sure which other environments people are using to build u-boot, hopefully any other environments pass the format string to strftime(). Just thought I'd bring it up in case someone reports an issue down the line.
Thanks,
Chris
--
[1] - http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html
[2] - http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html