liveElapsed renders a running wall-clock duration for the status bar: whole seconds under a minute (no sub-second decimal spinning at the spinner's refresh rate), then `6m 51s` / `1h 14m`. The lower unit is always two digits and round values are NOT collapsed (`8m 00s`, not `8m`), so the readout nev
(d time.Duration)
| 31 | // jumps from `7m 59s` straight to `8m` and back: it counts up visually steady. |
| 32 | // Used live (time.Since(turnStart)) and frozen at finish. |
| 33 | func liveElapsed(d time.Duration) string { |
| 34 | s := int(d.Seconds()) |
| 35 | if s < 60 { |
| 36 | return fmt.Sprintf("%ds", s) |
| 37 | } |
| 38 | if s < 3600 { |
| 39 | return fmt.Sprintf("%dm %02ds", s/60, s%60) |
| 40 | } |
| 41 | return fmt.Sprintf("%dh %02dm", s/3600, (s%3600)/60) |
| 42 | } |
| 43 | |
| 44 | // humanRate renders throughput: `25 tok/s`, `5.3 tok/s`. Returns "" on |
| 45 | // degenerate input (no tokens or zero elapsed) so the caller omits the |
no outgoing calls