update time one hour ahead
DL9LC opened this issue · 2 comments
At first i like to thank for this great library, but the example "TFT_eSPI_OpenWeather_LittleFS" shows a behavior i don't understand.
In the original code i have set the timezone to "euCET" and this gives the right time in the large clock display, but the updated time is one Hour ahead.
If i build the updeted timestring like the time for the big clock everything works well.
`void drawCurrentWeather() {
time_t local_time = TIMEZONE.toLocal( now() , &tz1_Code );
// new build timestring
String timeNow = "";
timeNow += day(local_time);
timeNow += ".";
timeNow += month(local_time);
timeNow += ". ";
if ( hour( local_time ) < 10 ) timeNow += "0";
timeNow += hour( local_time );
timeNow += ":";
if ( minute( local_time ) < 10 ) timeNow += "0";
timeNow += minute( local_time );
// String date = "Updated: " + strDate( local_time );
String date = "aktualisiert: " + timeNow;
// end new build timestring
`
Can someone explain this behavior?
Thanks a lot
Lena
I think i have found the problem in
`String strDate( time_t unixTime ) {
time_t local_time = TIMEZONE.toLocal( unixTime, &tz1_Code );
String localDate = "";
localDate += monthShortStr( month( local_time ) );
localDate += " ";
localDate += day( local_time );
localDate += " " + strTime( unixTime ); // unixTime? Not local_time?
return localDate;
}
`
Can you confirm it?
Greetings Lena
My current (european(nl)) Time is just right. Did you use the correct code from the NTP_Time.h? I have a problem that my update time = Jan 1 1970 1.00. Don't you have that??