mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-23 17:13:38 +00:00
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:
parent
8d90c496d0
commit
54bccb898e
@ -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));
|
||||
@ -265,4 +264,4 @@ time_t gm_mktime(struct tm *tm)
|
||||
setenv("TZ", "UTC0", 1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user