mirror of
https://github.com/MarekZegare4/MeshCore-Solo.git
synced 2026-07-26 14:58:12 +00:00
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:
@@ -645,10 +645,14 @@ public:
|
||||
char right[10];
|
||||
if (_filter == FILTER_COUNT - 1) {
|
||||
uint32_t now = rtc_clock.getCurrentTime();
|
||||
uint32_t age = (e.lastmod > 0 && now >= e.lastmod) ? now - e.lastmod : 0;
|
||||
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);
|
||||
if (e.lastmod == 0 || now < e.lastmod) {
|
||||
snprintf(right, sizeof(right), "?");
|
||||
} else {
|
||||
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 {
|
||||
if (e.dist_km >= 0.0f) geo::fmtDist(right, sizeof(right), e.dist_km, useImperial());
|
||||
else strncpy(right, "?GPS", sizeof(right));
|
||||
|
||||
Reference in New Issue
Block a user