milestone 27: diagnostics — operational failures land in one curated log, resolved history purgeable
Gates / frontend (push) Successful in 1m33s
Gates / test (push) Successful in 1m48s
Gates / test-aarch64 (push) Successful in 7m10s
Gates / package (push) Successful in 5m31s
Gates / container (push) Successful in 15s
CI / gates (push) Successful in 14m51s
Gates / frontend (push) Successful in 1m33s
Gates / test (push) Successful in 1m48s
Gates / test-aarch64 (push) Successful in 7m10s
Gates / package (push) Successful in 5m31s
Gates / container (push) Successful in 15s
CI / gates (push) Successful in 14m51s
This commit is contained in:
@@ -39,6 +39,18 @@ export function formatAge(seconds: number): string {
|
||||
return `${Math.floor(seconds)}s ago`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Seconds of elapsed time → a coarse "3h", the same single truncated unit as
|
||||
* `formatAge` without the "ago". For a span the caller labels itself, as in
|
||||
* "active for 3h". A negative span reads "0s": clock skew is not a duration.
|
||||
*/
|
||||
export function formatDuration(seconds: number): string {
|
||||
for (const unit of AGE_UNITS) {
|
||||
if (seconds >= unit.seconds) return `${Math.floor(seconds / unit.seconds)}${unit.suffix}`;
|
||||
}
|
||||
return `${Math.max(0, Math.floor(seconds))}s`;
|
||||
}
|
||||
|
||||
/** Microseconds → milliseconds with one decimal, e.g. 1234 → "1.2 ms". */
|
||||
export function formatMicros(micros: number): string {
|
||||
return `${(micros / 1000).toFixed(1)} ms`;
|
||||
|
||||
Reference in New Issue
Block a user