Run tzset() and localtime() in getTZOffset() to ensure proper timezone offset (#3999)

* Run tzset() and localtime() in getTZOffset() to ensure proper timezone offset

* Try #2 to fix timezone/DST
This commit is contained in:
Jonathan Bennett 2024-05-31 07:15:16 -05:00 committed by GitHub
parent 8d90c496d0
commit 54bccb898e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -222,9 +222,8 @@ bool perhapsSetRTC(RTCQuality q, struct tm &t)
*/
int32_t getTZOffset()
{
time_t now;
time_t now = getTime(false);
struct tm *gmt;
now = time(NULL);
gmt = gmtime(&now);
gmt->tm_isdst = -1;
return (int32_t)difftime(now, mktime(gmt));