MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / format_elapsed

Function format_elapsed

crates/openshell-cli/src/run.rs:385–394  ·  view source on GitHub ↗

Format a duration as a compact elapsed time string, e.g. `(3s)` or `(1m 12s)`.

(d: Duration)

Source from the content-addressed store, hash-verified

383
384/// Format a duration as a compact elapsed time string, e.g. `(3s)` or `(1m 12s)`.
385fn format_elapsed(d: Duration) -> String {
386 let secs = d.as_secs();
387 if secs < 60 {
388 format!("({secs}s)")
389 } else {
390 let mins = secs / 60;
391 let rem = secs % 60;
392 format!("({mins}m {rem}s)")
393 }
394}
395
396/// Format a total elapsed time for non-interactive mode timestamps.
397fn format_timestamp(d: Duration) -> String {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected