add timestamp during compile

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

add timestamp during compile

411 Views
jfannon
Contributor I

Hello,

 

I am looking for a way to include a timestamp in the code that I compile.  I want to assign an address in flash of say 4 bytes and put the date and time of compile into it automatically.(perhaps UTC time or some other format).  This way when I am looking at the firmware on a chip later I can determine when the code was compiled that is currently loaded.

 

Thank you for your help.

 

PS, I am programming a 9s08SH32 part if that makes any difference.

Labels (1)
0 Kudos
1 Reply

250 Views
kef
Specialist I

There are predefined standard C string constants __DATE__ and __TIME__. Usage is like

const char date[] = __DATE__;

 

Unfortunately you can't change format of these or encode them to long int or other more compact form.

0 Kudos