feat(tui): format last sample age concisely
Rust CI / cargo fmt (push) Successful in 17s
Rust CI / cargo clippy (push) Successful in 31s
Rust CI / cargo check (x86_64-unknown-linux-gnu) (push) Successful in 31s
Rust CI / cargo check (x86_64-unknown-linux-musl) (push) Failing after 9s
Rust CI / cargo test (x86_64-unknown-linux-musl) (push) Failing after 9s
Rust CI / cargo doc (push) Successful in 23s
Rust CI / cargo test (x86_64-unknown-linux-gnu) (push) Successful in 1m13s
Fuzz Smoke / cargo fuzz smoke (push) Failing after 27s
Supply chain / cargo-deny advisories (push) Successful in 8s
Supply chain / cargo-deny bans licenses sources (push) Successful in 5s
Supply chain / actionlint (push) Successful in 2s
Netem Interop / netem interop (push) Successful in 1m9s

This commit is contained in:
Nils Andreas Svee committed 2026-10-06 14:56:06 +07:00
1 parent b98d1001de
commit 4c941a7d78
1 file changed
+9 -1
+9 -1
View File
@@ -1032,7 +1032,7 @@ fn target_table(state: &TuiState, area: Rect) -> Table<'static> {
},
target
.last_sample
.map(|sample| format_span(sample.timestamp.mono.elapsed()))
.map(|sample| format_age(sample.timestamp.mono.elapsed()))
.unwrap_or_else(|| ABSENT.to_owned()),
])
.style(target_style(idx))
@@ -1631,6 +1631,14 @@ fn format_negotiated(negotiated: &NegotiationResult) -> String {
)
}
fn format_age(age: Duration) -> String {
match age.as_secs() {
0 => "<1s".to_owned(),
seconds @ 1..=59 => format!("{seconds}s"),
seconds => format!("{}m", seconds / 60),
}
}
/// Format a wall-clock span shown in the TUI's headers, config lines, and
/// graph window labels.
///