Re: SECONDS=0 does not reset SECONDS, or I'm missing something
From:
Chet Ramey
Subject:
Re: SECONDS=0 does not reset SECONDS, or I'm missing something
Date:
Thu, 4 Jun 2020 15:02:13 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.8.1
On 6/4/20 2:57 PM, Tim Visher wrote:
> Yes, SECONDS is in seconds granularity, whether that is seconds since the
> epoch or seconds since an assignment to it, as you quoted below. There's
> no expectation of subsecond granularity -- it's just whatever the system
> tells the shell the current number of seconds is.
>
> The next version will use the number of seconds returned from
> gettimeofday,
> but there's still nothing in there that attempts to round it up or down
> depending on tv_usec.
>
>
> Thanks for that explanation, Chet. So do I understand it correctly that an
> assignment to SECONDS triggers an internal caching of `now` (I assume down
> to whatever granularity the underlying system supports) and the value
> that's assigned to SECONDS is used as the offset that's added to it?
Yes, that's exactly how it works.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/