From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3178 invoked by alias); 1 Sep 2013 07:45:39 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31679 Received: (qmail 14639 invoked from network); 1 Sep 2013 07:45:23 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130901004527.ZM27352@torch.brasslantern.com> Date: Sun, 01 Sep 2013 00:45:27 -0700 In-reply-to: <20130831234733.GA83723@redoubt.spodhuis.org> Comments: In reply to Phil Pennock "sleep $floatval" (Aug 31, 4:47pm) References: <20130831234733.GA83723@redoubt.spodhuis.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: sleep $floatval MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Aug 31, 4:47pm, Phil Pennock wrote: > > So the float shows as 3.000000000e-01 which becomes a string, before > being passed to the built-in sleep, which then does not parse that > format as 0.3, nor show an error, but instead sleeps for 3 seconds > without an error. If $SleepDuration can be < 1, don't you want usleep $((SleepDuration * 1.0e+6)) instead? > What do folks think about sleep being a builtin, which can take > arbitrary formats and avoid forking an extra process, just to delay? I don't have any particular objection. Incidentally, the manual actually recommends zselect -t $((SleepDurationInSeconds * 100)) > Looking for a rough idea of whether people think the current behaviour > is problematic enough to make it worth adding another builtin. And > should it be sleep or zsleep, if so? The current behavior isn't problematic enough to have caused POSIX, bash, et al., to redefine sleep as a builtin, and it's not a problem I've ever encountered myself, but ... It could be added as one or more subcommands of zsystem (the only one currently is "flock"), e.g. "zsystem sleep $n", which allows you to do "if zsystem supports sleep; then ... fi". Otherwise I'd say zsleep is the best name for it, particularly if it magically converts floats into fractional second sleeps. If zsleep, then it could be a new module or be added to zsh/datetime.