[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: was there a more fine number than $SECONDS for the same purpose

From: Greg Wooledge
Subject: Re: was there a more fine number than $SECONDS for the same purpose
Date: Sun, 7 Nov 2021 08:17:56 -0500

On Sun, Nov 07, 2021 at 01:26:47PM +0100, Alex fxmbsw7 Ratchev wrote:
> oh, i know about this one, .. guess no since-startup accurate value..

You can store the value of EPOCHREALTIME in a different variable at the
start of your script, and then retrieve it again later on, and subtract
the two.  However, subtracting the two values will require forking an
external program, because bash can't do it.  So, you'd want to keep it
to a minimum.

If your goal is to display some sort of "stopwatch" that shows the
passing of real time with sub-second accuracy, may I suggest that bash
is not the best choice of language in which to do this?

On a slight tangent, I'd like to point out that Daylight Saving Time
ended this morning in the US.  So, once again, I got to run this little

while sleep .1s; do printf '\r%(%H:%M:%S)T'; done

I let that run while I set my wristwatch (which is the only device I own
which shows time to the second).  Then I use the wristwatch to set all
the other clocks in and around my house, which are all hour-and-minute
devices (except for the one clock that's analog).

Maybe that helps you in some way.  Maybe not.  We have no idea what you're
trying to do, because you aren't telling us.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]