refactor(tui): extract Activity readout and show local time
Move activity data assembly out of tui.py into activity_readout, behind readout(conn, selection, now). Dashboard and fenris-monitor enable now show local time with a timezone label, inspected points keep a secondary UTC line, and the legacy UTC-relabelled day and hour branches are gone. Time formatting (including freshness_age_human) lives in timefmt. Hour offsets now render as +05:30 to match day labels.
This commit is contained in:
@@ -183,19 +183,6 @@ def grade_freshness(newest_sample_ts: Optional[str], clock_now: datetime) -> str
|
||||
return "stale"
|
||||
|
||||
|
||||
def freshness_age_human(age_s: Optional[int]) -> str:
|
||||
"""Human-readable age string for freshness fact."""
|
||||
if age_s is None:
|
||||
return "unknown age"
|
||||
if age_s < 60:
|
||||
return "%ds ago" % age_s
|
||||
if age_s < 3600:
|
||||
return "%dm ago" % (age_s // 60)
|
||||
if age_s < 86400:
|
||||
return "%dh %dm ago" % (age_s // 3600, (age_s % 3600) // 60)
|
||||
return "%dd ago" % (age_s // 86400)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Drive anomalies (§9.7 — FL-7)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user