help-bash
[Top][All Lists]
Advanced

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

Re: SECONDS=0 does not reset SECONDS, or I'm missing something


From: Tim Visher
Subject: Re: SECONDS=0 does not reset SECONDS, or I'm missing something
Date: Fri, 5 Jun 2020 13:56:28 -0400

On Fri, Jun 5, 2020 at 11:59 AM Chet Ramey <chet.ramey@case.edu> wrote:

> On 6/4/20 6:01 PM, Andreas Kusalananda Kähäri wrote:
>
> > It's just a bit odd to have the SECONDS parameter tick with the system
> > time, which IMHO is not implied by the words "number of seconds since
> > the assignment", that's all.
>
> It looks like the problem is mismatched expectations. That's pretty common.
>
> So we have several options: update the documentation to specify that the
> system clock is used to determine the number of seconds; get a patch to
> the devel branch to change the behavior; or use one of the other available
> variables, like EPOCHREALTIME or EPOCHSECONDS.
>

To me, updating the documentation in some way seems the most reasonable
thing. It would feel even odder to me if one of the other variables didn't
exhibit the, to me, surprising behavior. I think the existence of `time` as
a bash builtin combined with Greg's suggestion earlier in the thread
suggests that this is just another bash-ism that scripters need to learn to
pick up on the way. Adopting zsh's behavior (especially at this point in
history) on any of the builtin timing variables seems like an overreach.

Just my 2¢.


reply via email to

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