[Top][All Lists]

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

Re: Add sleep builtin

From: Greg Wooledge
Subject: Re: Add sleep builtin
Date: Wed, 22 Aug 2018 08:22:11 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Aug 21, 2018 at 06:11:14PM -0700, L A Walsh wrote:
> sleep .001 (ms sleep)...not practical if loaded each time)
> I often use sleep .1/.3/.5 ... if the builtin doesn't support sleep times
> < 1 second, then it's probably not worth it.
> Also, needs to actually sleep for the listed time.

Just for the record, the POSIX sleep command only accepts an "integral
number of seconds specified by the time operand."  Sub-second sleep(1)
is a GNUism.

That said, ksh's builtin sleep accepts "decimal seconds or fractions of
a second", so there is precedent going that way... then again, ksh also
has floating point math *in general*, whereas bash does not.  Adding
floating-point support to bash's builtin sleep without adding it to
bash's arithmetic expressions might seem odd.

> I  remember some implementations only wait till the clock reaches the
> new time in seconds -- meaning that the actual sleep time could be
> .001 seconds.

If true, that would actually violate POSIX.  The sleep time must be
"at least" as long as the operand.  It may be longer, but never shorter.

You might be remembering it wrong.

reply via email to

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