coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] sleep: allow ms suffix for milliseconds


From: Stephane Chazelas
Subject: Re: [PATCH] sleep: allow ms suffix for milliseconds
Date: Mon, 2 Dec 2019 13:58:24 +0000
User-agent: NeoMutt/20180716

2019-11-29 13:30:36 +0000, Rasmus Villemoes:
[...]
> but that's a bit cumbersome. Extend sleep(1) to also accept "ms" as a
> suffix, so one can instead do
> 
>   sleep ${x}ms
[...]

Note that the sleep builtin of the ksh93 shell does support
ms, us and ns as suffixes. There,

sleep 1000ms
sleep 1000000us
sleep 1000000000ns

All do the same as "sleep 1".

However for a non-builtin sleep, us and ns are probably not as
useful as running the utility takes hundreds of microseconds.

mksh's sleep builtin supports fractional numbers, but not
ms/us/ns suffixes.

(same for bash though bash's sleep builtin (example loadable) is
generally not enabled by default and not shipped by many
distributions)

zsh has a zselect -t builtin which takes centiseconds

With GNU coreutils sleep (and ksh93's builtin but not that of
bash or mksh) one can add a e-3 suffix to get miliseconds (and
e-6 for us and e-9 for ns)

sleep 1 # s
sleep 1000e-3 # ms
sleep 1000000e-6 # us
sleep 1000000000e-9 # ns

-- 
Stephane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]