I would like to include the compile date and time into my C application. I am using the macros __DATE__ and __TIME__ at the minute but have run into some problems.
In one header file I have defined these:
#define APP_COMPILE_DATE __DATE__
#define APP_COMPILE_TIME __TIME__
I have three other source files in my project that include the header file above and use the variables directly. e.g. Each source file would contain:
printf("%s %s", APP_COMPILE_TIME, APP_COMPILE_DATE);
My problem is that when I run the program, all of the calls to APP_COMPILE_TIME return a different time from eachother.
Is there a way to make APP_COMPILE_DATE and APP_COMPILE_TIME constant in the header file?