Zsh Mailing List Archive
Messages sorted by:
Re: sleep $floatval
- X-seq: zsh-workers 31680
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: sleep $floatval
- Date: Sun, 1 Sep 2013 01:16:17 -0700
- Cc: zsh-workers@xxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201210; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=Y7+g9dzZNlW8TJUWHwdU48br7Khc0uxJBLFKbczvCCk=; b=BUy0KpIJDdz21iEjoYS2D590TCAe8mdPROfQmEjfhmFgERXU6QDbfQgk5hOl0ZcJmoWsm7OP7gDqRysRxWujB9hi2ElZUyGUCj7XiKQF5vG3wcHXZ7eiXR/DZcez0hzpUl70bwVAvpEvM+GkjPGttsRNKLKeIKAVQbacqEVROk8=;
- In-reply-to: <130901004527.ZM27352@torch.brasslantern.com>
- List-help: <mailto:email@example.com>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:firstname.lastname@example.org>
- Mail-followup-to: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20130831234733.GA83723@redoubt.spodhuis.org> <130901004527.ZM27352@torch.brasslantern.com>
On 2013-09-01 at 00:45 -0700, Bart Schaefer wrote:
> If $SleepDuration can be < 1, don't you want
> usleep $((SleepDuration * 1.0e+6))
I don't have a usleep(1) command. I do have a BSD sleep(1) command
which takes fractional seconds, both on FreeBSD and MacOS, and the
Ubuntu systems I see have a sleep(1) which does the same, and appears to
be from GNU coreutils.
It appears that the GNU coreutils variant correctly parses
"3.000000000e-01" and sleeps for 0.3 seconds, instead of 3 seconds.
> 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 ...
I think POSIX still doesn't specify any support for non-integral
sleep(1) durations, right?
> If zsleep, then it could be a new module or be added to zsh/datetime.
Am reconsidering in light of this being purely a BSD sleep(1) bug. Hrm.
Messages sorted by: