Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14524 > unrolled thread

Re: Add sleep builtin

Started byGreg Wooledge <wooledg@eeg.ccf.org>
First post2018-08-22 08:22 -0400
Last post2018-08-22 08:22 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Add sleep builtin Greg Wooledge <wooledg@eeg.ccf.org> - 2018-08-22 08:22 -0400

#14524 — Re: Add sleep builtin

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2018-08-22 08:22 -0400
SubjectRe: Add sleep builtin
Message-ID<mailman.5403.1534940541.1292.bug-bash@gnu.org>
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.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web