Use standard datetime format for build time info
- Use standard datetime format for build time info
This change set uses a standard ISO8601 and RFC3339 compliant date time format for the build time information linked into the KAS and agentk binaries.
Considerations:
Why not inject a UNIX timestamp?
- it's not human friendly.
- we would need to parse and format twice. Once from string UNIX
timestamp to an integer (because the linker only supports injecting
string values) and then to a
time.Time
object. And yet another formatting to a human friendly format (likely a standard one, like ISO8601 or RFC3339).
Why parse the injected build time in init
instead of a function
to retrieve it?
- convenience.
- only parse the format ones.
- BuildTimeFormatted is still convenient to be exported so we don't need to format it again.
This change set uses the date
command to get the timestamp, but we
need to be careful about that because date
is one of those commands
that is different on many systems: On most Linux distributions there is
GNU date, on Alpine and other minimal system there is a busybox date and
on Darwin is yet another date binary. The used date
options here are
working on all of those.
Changelog: changed