On 11/1/17 4:19 PM, Alan Dipert wrote:
> Hello all,
> 
> I understand there is a “special” variable, SECONDS, which returns the
> number of seconds since bash invocation when referenced.
> 
> Unfortunately for tasks like profiling one’s .profile, SECONDS is too
> coarse a unit. Milliseconds are more useful, but getting the time in
> milliseconds is only possibly by calling out to date. (At least, I’m not
> aware of a built-in way to get either Unix epoch or elapsed time in any
> sub-second unit) Shelling out to date isn’t desirable as it adds
> significant overhead and so complicates the task of profiling.

There is a special builtin in the devel branch version (EPOCHREALTIME) that
gives you the epoch time with microsecond resolution. It will be in the
next release.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to