[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Potentially misleading documentation of SECONDS variable
From: |
felix |
Subject: |
Re: Potentially misleading documentation of SECONDS variable |
Date: |
Thu, 15 Aug 2024 08:57:42 +0200 |
The variable $SECOND won't intend to be exact to the nanoseconds!
Not even to 1/100th... This variable is intended to show current
time of execution, at SECOND resolution.
This variable is simply incremented each time SYSTEM CLOCK increment
his SECOND part of current time.
Try this little command line many times:
~$ secTest() {
bash -c 'start=${EPOCHREALTIME};
while !((SECONDS));do
sleep .02;done;
end=${EPOCHREALTIME};
dur=00000$(( ${end/.}-${start/.} ));
printf "Second duration: %.5f\n" ${dur::-6}.${dur: -6}';
}
~$ secTest
Second duration: 0.33484
~$ secTest
Second duration: 0.04215
You won't ever see an answer higher than 0.99999 seconds!
... But you may notice some seconds incremented at 0.00001 seconds!
Le Wed, Aug 07, 2024 at 09:10:40AM -0500, G. Branden Robinson a écrit :
> At the risk of splitting hairs, I would cast the added phrase as:
>
> "at a resolution of one second".
--
Félix Hauri - <felix@f-hauri.ch> - http://www.f-hauri.ch
Re: Potentially misleading documentation of SECONDS variable, Chet Ramey, 2024/08/06
Re: Potentially misleading documentation of SECONDS variable, Ángel, 2024/08/06