Skip to content

Commit

Permalink
Try #2 to fix timezone/DST
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-bennett committed May 31, 2024
1 parent 7e81375 commit a919ee6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/gps/RTC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,11 @@ bool perhapsSetRTC(RTCQuality q, struct tm &t)
*/
int32_t getTZOffset()
{
tzset();
time_t now;
time_t now = getTime(false);
struct tm *gmt;
struct tm *local;
now = time(NULL);
gmt = gmtime(&now);
local = localtime(&now);
return (int32_t)difftime(mktime(local), mktime(gmt));
gmt->tm_isdst = -1;
return (int32_t)difftime(now, mktime(gmt));
}

/**
Expand Down

0 comments on commit a919ee6

Please sign in to comment.