fix(NearbyScreen): show "?" for contacts with no timestamp in TIME filter

lastmod == 0 produced age = 0 → displayed as "0s"; now shows "?" instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-09 17:19:06 +02:00
co-authored by Claude Sonnet 4.6
parent 54ab351b2f
commit 562cef3261
@@ -645,10 +645,14 @@ public:
char right[10]; char right[10];
if (_filter == FILTER_COUNT - 1) { if (_filter == FILTER_COUNT - 1) {
uint32_t now = rtc_clock.getCurrentTime(); uint32_t now = rtc_clock.getCurrentTime();
uint32_t age = (e.lastmod > 0 && now >= e.lastmod) ? now - e.lastmod : 0; if (e.lastmod == 0 || now < e.lastmod) {
if (age < 60) snprintf(right, sizeof(right), "%us", age); snprintf(right, sizeof(right), "?");
else if (age < 3600) snprintf(right, sizeof(right), "%um", age / 60); } else {
else snprintf(right, sizeof(right), "%uh", age / 3600); uint32_t age = now - e.lastmod;
if (age < 60) snprintf(right, sizeof(right), "%us", age);
else if (age < 3600) snprintf(right, sizeof(right), "%um", age / 60);
else snprintf(right, sizeof(right), "%uh", age / 3600);
}
} else { } else {
if (e.dist_km >= 0.0f) geo::fmtDist(right, sizeof(right), e.dist_km, useImperial()); if (e.dist_km >= 0.0f) geo::fmtDist(right, sizeof(right), e.dist_km, useImperial());
else strncpy(right, "?GPS", sizeof(right)); else strncpy(right, "?GPS", sizeof(right));