Display drifitng stats

This commit is contained in:
jpirnay
2026-03-27 11:49:13 +01:00
parent 92877f9c36
commit 316a1ac3ab
5 changed files with 98 additions and 2 deletions
+2
View File
@@ -227,6 +227,8 @@ bool isSynced() {
bool isApproximate() { return clockApproximate; }
time_t lastSyncTime() { return nvsReadSyncTime(); }
void formatTime(char* buf, size_t bufSize, bool use24h) {
if (!isSynced()) {
snprintf(buf, bufSize, "--:--");
+4
View File
@@ -55,6 +55,10 @@ bool isSynced();
/// may have drifted. Cleared on NTP sync.
bool isApproximate();
/// Returns the epoch of the last successful NTP sync (from NVS), or 0 if
/// no sync has ever been recorded.
time_t lastSyncTime();
/// Format the current time for display. Returns "--:--" if the clock was
/// never synced, prefixes with "~" if approximate.
/// When use24h is false, formats as "2:05pm" / "12:30am".