This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Timestamp of compilation

I was searching for a way to include a timestamp in during compilation/preprocessing.
I found the famous __DATE__ and __TIME__, however these are not suitable for version control, because the timezone is missing and they are written in humans.

Is there any standard way the toolchain can put a iso8601 (utc) or unix timestamp into the firmware?

Parents
  • Correct.
    But people keep sharing firmware without updating #define VERSION x.x.x.x...
    Then you have conversations about version 5 new and version 5 old... not the best way.
    That why I think the build number or utc build time is a safer way to fix this, since anyone/anything can read this.

    Yet, this seemingly missing feature from compilers could easily be replaced by a call to a third party program or script. If people keep that option enabled in the configuration...
    That script could also insert the parent git hash, so there is some track of the sources.

Reply
  • Correct.
    But people keep sharing firmware without updating #define VERSION x.x.x.x...
    Then you have conversations about version 5 new and version 5 old... not the best way.
    That why I think the build number or utc build time is a safer way to fix this, since anyone/anything can read this.

    Yet, this seemingly missing feature from compilers could easily be replaced by a call to a third party program or script. If people keep that option enabled in the configuration...
    That script could also insert the parent git hash, so there is some track of the sources.

Children