zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: typeset -F3 SECONDS doesn't work the first time
Date: Thu, 28 Jun 2012 15:00:35 -0700	[thread overview]
Message-ID: <120628150035.ZM28226@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3S=YsJrSKYcFCvm+yrH_f4Tuy_WkL2UWnqoj3L3xoc_eA@mail.gmail.com>

On Jun 28,  8:11pm, Mikael Magnusson wrote:
}
} Right, the fractional part was what I wanted to show. sleep in both
} pipelines can sleep for subsecond intervals, but afaik there's no
} builtin sleep command in zsh.

Hrm, dunno what I was thinking there except that I couldn't figure
out why you used =sleep in one example but not the other.

In any case init.c:setupvals() loads the shtimer global directly to
initialize SECONDS and then a bit later calls createparamtable() to
copy the environment, which goes through params.c:intsecondssetfn()
which resets shtimer.tv_sec and zeroes shtimer.tv_usec.

So this probably has to do with rounding error when converting shtimer
to double by typecast and division in params.c:floatsecondsgetfn().

Same thing happens without the code snippet from workers/30540 so that's
not involved.


      reply	other threads:[~2012-06-28 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 16:26 Mikael Magnusson
2012-06-27 17:50 ` Bart Schaefer
2012-06-27 17:58   ` Mikael Magnusson
2012-06-28 16:54     ` Bart Schaefer
2012-06-28 17:04       ` Mikael Magnusson
2012-06-28 18:06         ` Bart Schaefer
2012-06-28 18:11           ` Mikael Magnusson
2012-06-28 22:00             ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=120628150035.ZM28226@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).