add timestamp during compile

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

add timestamp during compile

437件の閲覧回数
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.

ラベル(1)
0 件の賞賛
1 返信

276件の閲覧回数
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 件の賞賛