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

Re: PATCH: zsh/datetime $EPOCHREALTIME



On Wed, 10 Aug 2011 08:30:17 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Aug 10, 12:41pm, Peter Stephenson wrote:
> }
> } I'm actually wondering if we ought to be a bit smarter and add an
> } epochrealtime array with the seconds and nanoseconds as elements
> } (guaranteed to be consistent, obviously). Exercise for the reader.
> 
> Better (?) still:
> 
> Allow the user to apply typeset to EPOCHSECONDS.  If it's an int,
> it is as it is now.  If it's a float, what you called EPOCHREALTIME.
> If an array, elements for seconds and nanoseconds.  If a hash, the
> keys are tv_sec and tv_nsec like a timespec (convert from tv_usec
> when using gettimeofday).
> 
> Too bad that would require mucking about with whether it's special
> and readonly, or else introducing provision for other special cases
> into typeset ...

That's the trick I did with SECONDS, but a utility library like
zsh/datetime might be called in lots of different places and come a
cropper if the type is wrong (e.g. supplying a float to strftime screws
up), so I thought it would be better to minimise the assumptions needed.

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


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog



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