Format a duration as a compact elapsed time string, e.g. `(3s)` or `(1m 12s)`.
(d: Duration)
| 383 | |
| 384 | /// Format a duration as a compact elapsed time string, e.g. `(3s)` or `(1m 12s)`. |
| 385 | fn 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. |
| 397 | fn format_timestamp(d: Duration) -> String { |
no outgoing calls
no test coverage detected