- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have seen other compilers, like IAR, support preprocessor macros__DATE__ and __TIME__. __DATE__ is a preprocessor macro that expands to the current date (at compile time) in the form mmm dd yyyy (e.g. "Jan 14 2012"), as a string. The __DATE__ macro can be used to provide information about the particular moment a binary was built. The __TIME__ macro gets the current time of the build. I think the answer is no but wondering if there is something like this available so my C code could access to when it was built.
Thanks,
Mark
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PSoC Creator supports __DATE__ and __TIME__ preprocessor macros. You can use them to obtain the compilation date and time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PSoC Creator supports __DATE__ and __TIME__ preprocessor macros. You can use them to obtain the compilation date and time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you GeonaM_26!
Sure enough, this works:
DBG_PRINTF("\n%s %s", __DATE__, __TIME__);
I went to find the address of these string constants and this works too.
DBG_PRINTF("%p\n", (void*) __DATE__); //Prints address of string constant
DBG_PRINTF("%p\n", (void*) __TIME__);
I used the memory viewer and they were there in flash.
Another question: Where are these string constants documented?
They don't seem to be defined anywhere. I wonder what else I am missing.
Cheers!
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
These are standard predefined macros. Please goto https://gcc.gnu.org/onlinedocs/cpp/Predefined-Macros.html#Predefined-Macros for more details.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is so cool. I had no idea. Live and learn.