A game has this:
I'm curious to whether this was the actual build time, and sure enough, the 'File Last Modified' date of Crysis.exe
(the program) is 03/31/2009, 01:40
.
Sure, the developer could easily have manually inputted that value, and built the application in under a minute, but I'm curious to whether it is actually possible to input the current date/time (to the nearest second) when the application is actually building.
This would have many advantages, including easy identification of different builds of the application.
Is this possible?
Yes the time of built is provided by the
__TIME__
macro. In your example they also use__DATE__
macro which provides the date.LIVE DEMO
Yes. Several approaches come to mind:
Use C's
__DATE__
and__TIME__
macros. They're part of the standard, however, they take the time the particular file was last built. So that means if you e.g. put the build date in your app's about screen, then the date will only be updated when you either do a complete clean build, or you change the about screen source file. To fix this, you could add a script to your build process that e.g. callsTo forcibly trigger a rebuild.
Write a shell script that you run before each build that generates a header file like
and run that script before each build. Since the file is generated new each time, your build process should notice it has changed and automatically trigger a new build of the about screen or whatever shows your build date/time.