Hi all,
I was reading Anders Lindgren's response on the Internet about clever __DATA__ and __TIME__, but i have problem to implement it on my MSP430F5438A.
What I wanted is to put the time of compiling inside of microcontroler, so that I can use it later in RTC.
A piece of code is following:
#define DIGIT(s, no) ((s)[no] - '0')
const int hours = (10 * DIGIT(__TIME__, 0) + DIGIT(__TIME__, 1));
const int minutes = (10 * DIGIT(__TIME__, 3) + DIGIT(__TIME__, 4));
const int seconds = (10 * DIGIT(__TIME__, 6) + DIGIT(__TIME__, 7));
/* WARNING: This will fail in year 10000 and beyond, as it assumes
* that a year has four digits. */
const int year = ( 1000 * DIGIT(__DATE__, 7)
+ 100 * DIGIT(__DATE__, 8)
+ 10 * DIGIT(__DATE__, 9)
+ DIGIT(__DATE__, 10));
But when i want to build project i only get compiler error #28 expression must have a constant value error.
I hope somebody can help me.
Thanx
Nemanja