1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 15:18:01 +00:00
Files
til/unix/print-milliseconds-in-human-readable-format.md

764 B
Raw Blame History

Print Milliseconds In Human-Readable Format

I ran a command in a program. It doesn't really matter what command or program. What does matter is that it took a long time and when it finished, it told me how long it took, but in milliseconds.

835953ms

Typically, when I see a timing number like this, I open Alfred and do some quick math (N / 1000 / 60 / 60 or something like that).

There is an easier way, using the pretty-ms-cli. This purpose-built CLI can be run using something like npx. All I do is hand it the number of milliseconds and it prints out how long that is in something that I can understand.

 npx pretty-ms-cli 835953
13m 56s