get the compile time from your PC
uint32_t targetTime = 0;// for next 1 second timeout
uint8_t hh,mm,ss; //containers for current time
static uint8_t conv2d(const char* p)
{
uint8_t v = 0;
if ('0' <= *p && *p <= '9') v = *p - '0';
return 10 * v + *++p - '0';
}
void setup(void)
{
hh = conv2d(__TIME__);
mm = conv2d(__TIME__+3);
ss = conv2d(__TIME__+6);
targetTime = millis() + 1000;
}
void loop()
{
if (targetTime < millis())
{
targetTime = millis()+1000;
ss++;
if (ss >59)
{
ss = 0; mm++;
if(mm > 59)
{
mm = 0; hh++;
if (hh > 23) hh = 0;
}
}
}
}