meshtastic / firmware

Meshtastic device firmware
https://meshtastic.org
GNU General Public License v3.0
2.98k stars 714 forks source link

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

Closed jp-bennett closed 1 month ago

jp-bennett commented 1 month ago

Fixes #3812 My guess is that we run tzset before we have a valid date, so the DST element can't happen. This moves that to every time we attempt to calculate the offset, as well as moving to localtime() to make sure we get the proper timezone offset.

jp-bennett commented 1 month ago

I misunderstood the problem the first time around (and had a local node broadcasting a bogus time). The solution is actually really simple: Just use the real time for our "now" variable, to calculate the offset.