Comment by mgaunard

2 years ago

Don't you have to fake the system time to do this? The time often ends up inside the binaries one way or another.

Could you name an example of how (and for what reason) this might happen?

  • Typically part of a "version string":

        $ python3
        Python 3.10.7 (main, Jan  1 1970, 00:00:01) [GCC 11.3.0] on linux
        Type "help", "copyright", "credits" or "license" for more information.
        >>>
    

    Perhaps a relic from when software had to be manually updated?

    • On NixOS, I think the release time or commit time is used:

          $ python3
          Python 3.10.11 (main, Apr  4 2023, 22:10:32) [GCC 12.2.0] on linux
          Type "help", "copyright", "credits" or "license" for more information.
          >>> 
      

      That is more useful than the build time.

      5 replies →

  • GCC embeds timestamps in o/gcno/gcda files to check they match.

    It's mostly annoying as gcov will actively prevent you from using gcda files from a different but equivalent binary than what generated the gcno.

You would just either not include the timestamp at all in all builds, or set 0, so the build date is 1970 everywhere.