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

Re: [RFC] Millisecond and microsecond specifiers for TIMEFMT



On Mon, 11 Dec 2017 19:58:41 -0600
dana <dana@xxxxxxx> wrote:
> I am often interested in getting sub-second-precision timing on shell
> commands, but the `time` built-in doesn't offer this (not really,
> anyway). I can kind of work around it by writing a function that
> fiddles with SECONDS, but my function doesn't have the fancy syntax
> support that `time` has, which makes it inconvenient for measuring
> some things.

You don't need to fiddle with SECONDS beyond turning it into floating
point,

typeset -F SECONDS

at which point it's just a question of subtraction, which isn't usually
regarded as particularly problematic.

> What i'd really like is if TIMEFMT supported sequences for milliseconds and
> microseconds.
> 
> I had a look and it really does seem quite simple to implement. How would you
> feel about something like the change below?

Can't see any obvious problem with this.  Just needs documenting.

pws



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