On 2019-11-29 21:58, Kaz Kylheku (Coreutils) wrote:
> Sleeping for 15500 milliseconds is valid.
> 
> But in any case, we can already do that with "sleep 15.500".
> 
> The issue is that it's cumbersome to convert from 15500 to 15.500
> in a shell script.

This can easily be done ... with the shell's integer arithmetic
and due to the fact the GNU sleep adds all arguments to the final
nanosleep(2) time:

  $ x=15500
  $ sleep  $((x/1000))  0.$((x%1000))

I'm still not convinced - especially since the suggested suffix "ms"
is a 2-character suffix and therefore would change the 1-character
rule of suffix.  I'm not sure if this could be a problem somewhere,
though.

If we want to support a suffix meaning a sub-second multiplier,
then - as the underlying system call is nanosleep(2) - I'd rather
go for using the single-char 'n' as suffix for nanoseconds.

Have a nice day,
Berny

Reply via email to