From 651217aecb42fc4458a9dee13f36460456ebdfb7 Mon Sep 17 00:00:00 2001 From: "Rich O." Date: Sun, 1 Nov 2026 16:04:28 -0500 Subject: [PATCH] palm-client: ignore a nonsense system time zone; dates on the clock line The Neo's prefMinutesWestOfGMT was 1140 (19 h), so the default UTC offset was -19 h, which explains the radio clock being set to the wrong day. A system value past +-14 h is now ignored (offset 0 until set in Settings). The Node clock line shows dates too: the remaining problem looks like the Visor's date, which the times alone couldn't show. --- palm-client/src/app.c | 9 +++++++-- palm-client/src/node_form.c | 14 +++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/palm-client/src/app.c b/palm-client/src/app.c index 7ba41e3..daa196a 100644 --- a/palm-client/src/app.c +++ b/palm-client/src/app.c @@ -23,6 +23,7 @@ void AppLoadPrefs(void) { AppPrefs prefs; UInt16 size = sizeof(prefs); + Int32 west; if (PrefGetAppPreferences(VM_CREATOR, VM_PREFS_ID, &prefs, &size, true) != noPreferenceFound && size == sizeof(prefs) && prefs.version == VM_PREFS_VERSION) { @@ -30,8 +31,12 @@ void AppLoadPrefs(void) SessionSetUtcOffset(prefs.utcOffset); return; } - /* no saved offset yet: start from the system's, if it has one */ - SessionSetUtcOffset(-(Int16)PrefGetPreference(prefMinutesWestOfGMT)); + /* + * No saved offset yet: start from the system's, if it's a real zone. The + * Neo's held 1140 (19 h), which made times 19 h off; ignore anything past +-14 h. + */ + west = (Int32)PrefGetPreference(prefMinutesWestOfGMT); + SessionSetUtcOffset(west >= -840 && west <= 720 ? (Int16)-west : 0); } void AppSavePrefs(void) diff --git a/palm-client/src/node_form.c b/palm-client/src/node_form.c index b6ab459..0fd0cd1 100644 --- a/palm-client/src/node_form.c +++ b/palm-client/src/node_form.c @@ -73,15 +73,15 @@ static void ShowRadioInfo(FormType *form) /* * Clock check, small font, under the radio details: - * Visor 17:02 UTC 22:02 (-5h) - * radio 11:57 UTC sys -300 + * Visor 11/1 17:02 UTC 11/1 22:02 (-5:00) + * radio 11/1 11:57 UTC sys 300 * "sys" is Palm OS's own minutes-west-of-GMT preference (the offset's default). */ static void DrawClockLine(void) { DateTimeType dt; RectangleType r; - Char line[48], utc[8], radio[8]; + Char line[56], utc[16], radio[16]; UInt32 now = TimGetSeconds(); Int16 off = SessionUtcOffset(); UInt32 rt = SessionRadioTime(); @@ -90,16 +90,16 @@ static void DrawClockLine(void) RctSetRectangle(&r, 0, 104, 160, 20); WinEraseRectangle(&r, 0); TimSecondsToDateTime(SessionNow() + 2082844800UL, &dt); - StrPrintF(utc, "%02u:%02u", dt.hour, dt.minute); + StrPrintF(utc, "%u/%u %02u:%02u", dt.month, dt.day, dt.hour, dt.minute); TimSecondsToDateTime(now, &dt); - StrPrintF(line, "Visor %02u:%02u UTC %s (%s%d:%02dh)", dt.hour, dt.minute, utc, + StrPrintF(line, "Visor %u/%u %02u:%02u UTC %s (%s%d:%02d)", dt.month, dt.day, dt.hour, dt.minute, utc, off < 0 ? "-" : "+", (off < 0 ? -off : off) / 60, (off < 0 ? -off : off) % 60); WinDrawChars(line, StrLen(line), 5, 105); if (rt) { TimSecondsToDateTime(rt + 2082844800UL, &dt); - StrPrintF(radio, "%02u:%02u", dt.hour, dt.minute); + StrPrintF(radio, "%u/%u %02u:%02u", dt.month, dt.day, dt.hour, dt.minute); } else { - StrCopy(radio, "--:--"); + StrCopy(radio, "--"); } StrPrintF(line, "radio %s UTC sys %ld", radio, (Int32)PrefGetPreference(prefMinutesWestOfGMT)); WinDrawChars(line, StrLen(line), 5, 113);