How to get build time?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
gykim
Level 3
Level 3
25 sign-ins 10 replies posted 10 sign-ins

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

================================================

0 Likes
1 Solution
Rakesh_BG
Moderator
Moderator
Moderator
50 solutions authored 100 replies posted 100 sign-ins

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

View solution in original post

0 Likes
2 Replies
Rakesh_BG
Moderator
Moderator
Moderator
50 solutions authored 100 replies posted 100 sign-ins

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

0 Likes

Thanks Rakesh B G.

It works well.

0 Likes