fix(gps): Arizona no-DST carve-out + raise unsynced-display threshold to 2024

Addresses Greptile review on #36:
- Arizona is inside the Mountain longitude band but doesn't observe DST (and it
  straddles the Mountain/Pacific boundary), so MST7MDT wrongly showed MDT in
  summer. It now gets an explicit MST7 (no-DST) carve-out by lat/lon box before
  the longitude bands. (The DST-observing Navajo Nation is not separately handled.)
- The Settings "Time:" display used a >= 2016 threshold, which let the ESP32's
  ~2016-01-01 first-boot default render as a real date instead of "not set".
  Raised to >= 2024 so an unsynced clock is visibly unsynced.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UWZuYkHBRqNb6BZHV8sTG5
This commit is contained in:
torlando-agent[bot]
2026-06-22 17:08:22 -04:00
co-authored by Claude Opus 4.8
parent c208e9aaec
commit 27ff17b2ad
2 changed files with 11 additions and 4 deletions
+10 -3
View File
@@ -320,12 +320,19 @@ bool sync_time_from_gps(uint32_t timeout_ms = 30000) {
// US bands use POSIX strings WITH DST rules, so summer correctly shows EDT/CDT/
// MDT/PDT instead of standard time. The old code used a raw longitude offset with
// no DST rule, so e.g. Eastern showed EST in June (1h slow). Outside those bands,
// fall back to a plain longitude offset (no DST) -- which is also correct for
// non-DST regions like Arizona/Puerto Rico that a blanket rule would get wrong.
// fall back to a plain longitude offset (no DST) -- correct for non-DST / non-US
// regions like Puerto Rico. Arizona (Mountain band, no DST) gets a carve-out below.
double longitude = gps.location.lng();
double latitude = gps.location.lat();
const char* tz_str;
char tz_buf[32];
if (longitude >= -82.5 && longitude < -67.0) tz_str = "EST5EDT,M3.2.0,M11.1.0"; // Eastern
// Arizona (excl. the Navajo Nation) is MST year-round -- no DST -- AND straddles
// the Mountain/Pacific longitude boundary, so check its lat/lon box before the
// longitude bands. Approximate box; the DST-observing Navajo Nation in the NE
// corner is not separately handled.
if (latitude >= 31.3 && latitude <= 37.0 && longitude >= -114.9 && longitude <= -109.0)
tz_str = "MST7"; // Arizona: no DST
else if (longitude >= -82.5 && longitude < -67.0) tz_str = "EST5EDT,M3.2.0,M11.1.0"; // Eastern
else if (longitude >= -97.5 && longitude < -82.5) tz_str = "CST6CDT,M3.2.0,M11.1.0"; // Central
else if (longitude >= -112.5 && longitude < -97.5) tz_str = "MST7MDT,M3.2.0,M11.1.0"; // Mountain
else if (longitude >= -127.5 && longitude < -112.5) tz_str = "PST8PDT,M3.2.0,M11.1.0"; // Pacific