Re: Increasing "time" command precision
On Wed, Aug 07, 2024 at 22:15:00 +0200, Thomas Schmitt wrote:
> it turns out that TIMEFORMAT belongs to the bash builtin "time"
> and that digit precision numbers only up to 3 are obeyed.
>
> $ export TIMEFORMAT="r=%7R
> u=%4U
> s=%1S"
> $ time echo
>
> r=0.000
> u=0.000
> s=0.0
Just for the record:
* You can use the $'...' quoting form in bash, to put newlines in
a string value using \n.
* TIMEFORMAT=... time foo will invoke /usr/bin/time, but
TIMEFORMAT=... eval time foo will use the builtin.
hobbit:~$ TIMEFORMAT=$'real %R\nuser %U\nsys %S' eval time sleep 0.2
real 0.202
user 0.002
sys 0.001
Reply to: