NTP error by one hour.
tassyjim opened this issue · 1 comments
When using 24 hour display, the time is out by one hour.
When using 12 hour time, the date doesn't roll over until 0100.
I have made two changes to rt_clock.ino
In RealTimeClock::tick()
you have
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
const uint32_t seventyYears = 2208988800UL + 3600UL;
// subtract seventy years:
I removed the '+ 3600UL'
const uint32_t seventyYears = 2208988800UL;
That gets 24 hour time correct
To adjust 12 hour time, this is my crude change to RealTimeClock::getCurrentTimeFormatted():
if(f.indexOf("%hh")>=0)
{
if((c.getHour() % 12)== 0){
f.replace("%hh","12");
}
else
{
sprintf(str,"%02d",(int)(c.getHour() % 12));
f.replace("%hh",str);
}
}
if(f.indexOf("%h")>=0)
{
if((c.getHour() % 12)== 0){
f.replace("%h","12");
}
else
{
sprintf(str,"%d",(int)(c.getHour() % 12));
f.replace("%h",str);
}
}
I am sure that there is a better way to handle zero hours.
Thanks for a great product.
Jim
Thanks! I'll get this change in ASAP!