Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: typeset -F3 SECONDS doesn't work the first time



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.



Messages sorted by: Reverse Date, Date, Thread, Author