- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all.
I have a simple question.
How to get build date and time?
I want to display it as debug message in my application.
================================================
My environments are...
Modus toolbox ver : 2.4
cyw20819A1
================================================
Solved! Go to Solution.
- Labels:
-
ModusToolbox General
- Tags:
- build time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @gykim ,
You can add the below line to get the build date and time in console.
printf ("Date : %s and Time %s.\n",__DATE__, __TIME__);
__DATE__
This macro expands to a string constant that describes the date on which the preprocessor is being run. The string constant contains eleven characters and looks like "Feb 12 1996"
. If the day of the month is less than 10, it is padded with a space on the left.
If GCC cannot determine the current date, it will emit a warning message (once per compilation) and __DATE__
will expand to "??? ?? ????"
.
__TIME__
This macro expands to a string constant that describes the time at which the preprocessor is being run. The string constant contains eight characters and looks like "23:59:01"
.
If GCC cannot determine the current time, it will emit a warning message (once per compilation) and __TIME__
will expand to "??:??:??"
.
Thanks,
Rakesh B G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @gykim ,
You can add the below line to get the build date and time in console.
printf ("Date : %s and Time %s.\n",__DATE__, __TIME__);
__DATE__
This macro expands to a string constant that describes the date on which the preprocessor is being run. The string constant contains eleven characters and looks like "Feb 12 1996"
. If the day of the month is less than 10, it is padded with a space on the left.
If GCC cannot determine the current date, it will emit a warning message (once per compilation) and __DATE__
will expand to "??? ?? ????"
.
__TIME__
This macro expands to a string constant that describes the time at which the preprocessor is being run. The string constant contains eight characters and looks like "23:59:01"
.
If GCC cannot determine the current time, it will emit a warning message (once per compilation) and __TIME__
will expand to "??:??:??"
.
Thanks,
Rakesh B G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Rakesh B G.
It works well.