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

Re: foo=${(z)${(s:.:)SECONDS}} ; echo ${foo[1]}.${(r:2:)foo[2]}



On Thu, 25 Oct 2007 16:37:03 +1300 (NZDT)
Atom Smasher <atom@xxxxxxxxxxx> wrote:
> from the man page...
> 
>  	For example, `typeset -F SECONDS' causes the value to be reported 
> as a floating point number.  The precision is six decimal places, although 
> not all places may be useful.

"Six" is wrong, ten is correct, but this is the wrong place to document it.
I'll fix that.

> but i see something like this...
>  	% echo $SECONDS
>  	25912.5868740000
> 
> with ten decimal places.
> 
> i want that number to be reported only to hundredths of a second (two 
> decimal places).

If you'd been reading the write part of the manual (the documentation for
typeset -F)...

   typeset -F 2 SECONDS

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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