OpenWeather icon indicating copy to clipboard operation
OpenWeather copied to clipboard

update time one hour ahead

Open DL9LC opened this issue 2 years ago • 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

DL9LC avatar Mar 20 '23 17:03 DL9LC

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

DL9LC avatar Mar 20 '23 21:03 DL9LC

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??

digitongithub avatar Mar 22 '23 07:03 digitongithub