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

Re: PATCH: zsh/datetime $EPOCHREALTIME

On 10 August 2011 17:30, 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 ...

If it's an array, how do you get both elements at the 'same' time? I'm
guessing you would always have to copy the array in one step and then
access the elements in the copy.

Mikael Magnusson

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