mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 17:42:48 +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()
|
int32_t getTZOffset()
|
||||||
{
|
{
|
||||||
time_t now;
|
time_t now = getTime(false);
|
||||||
struct tm *gmt;
|
struct tm *gmt;
|
||||||
now = time(NULL);
|
|
||||||
gmt = gmtime(&now);
|
gmt = gmtime(&now);
|
||||||
gmt->tm_isdst = -1;
|
gmt->tm_isdst = -1;
|
||||||
return (int32_t)difftime(now, mktime(gmt));
|
return (int32_t)difftime(now, mktime(gmt));
|
||||||
|
Loading…
Reference in New Issue
Block a user