Closed shtrom closed 1 year ago
Great idea to show the GMT offset in the syncNTP screen! I think we don't want to persist the GMT offset though because that will change throughout the year due to daylight savings (the weather API [timezone] accounts for that.
It might also be a good to have an option that allows the user to choose between the hardcoded GMT offset, or pull from timezone data using the weather API.
With the current code on master
, manually triggering the NTP sync would reset the offset to the hardcoded one, regardless of what was obtained from the weather data. The DST offset will get updated, if needed, every time the weather API is queried.
With this change, the weather data offset becomes the offset for both automatic and manual updates. This is why a new RTC_DATA
variable is needed to store the offset beyond what is hardcoded in the watchySettings
. This allows to get all NTP syncs, automatic or manual, to behave consistently, which I think is desirable.
I see your point about letting the hardcoded offset override the weather data (noting that there's no UI setting for it in the watch menu at the moment, and it needs a recompile). Maybe the tradeoff would be to use the hardcoded offset if present and valid in the watchySettings
, and otherwise use the weather data to set it. We could just set it to something invalid by default, say INT_MAX
, or maybe just -1 for ease of detection (but that's a bit iffy).
Let me know what you think, and I'll update the code.
(Unrelated, I pushed a fixup that restores the syncNTP
-after-weather I previously deleted, as I now realise it's now beneficial to do it every so often to avoid the RTC drifting too far.)
@sqfmi What do you think about my previous suggestion?
[a] tradeoff would be to use the hardcoded offset if present and valid in the
watchySettings
, and otherwise use the weather data to set it. We could just set it to something invalid by default, say INT_MAX, or maybe just -1 for ease of detection (but that's a bit iffy).
Thanks, merged!
This extends the recent changes to get DST from the weather data to also persist the information in
gmtOffset
, so the gmtOffset can also be determined automatically.