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


Groups > gnu.bash.bug > #14524

Re: Add sleep builtin

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Add sleep builtin
Date Wed, 22 Aug 2018 08:22:11 -0400
Lines 26
Approved bug-bash@gnu.org
Message-ID <mailman.5403.1534940541.1292.bug-bash@gnu.org> (permalink)
References <CAJnmqwZ1GUZRtGRHt8xy_-tdTjVsAQKt-toGAEn5e9gjFrR0vQ@mail.gmail.com> <83513822-23BF-4695-9542-F967512A8A3D@gmail.com> <5B7CB832.4080004@tlinx.org>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1534940542 28516 208.118.235.17 (22 Aug 2018 12:22:22 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
Mail-Followup-To bug-bash@gnu.org
Content-Disposition inline
In-Reply-To <5B7CB832.4080004@tlinx.org>
User-Agent NeoMutt/20170113 (1.7.2)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 139.137.100.1
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14524

Show key headers only | View raw


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.

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web