On Mär 23 2023, William Kennington via Bug reports for the GNU Bourne Again 
SHell wrote:

> We have systems that start off with inaccurate clocks and at some point
> after the boot process synchronize with the network and jump forward in
> time. This has the potential to break any scripts that are sitting in
> loops, calculating a timeout based on the $SECONDS variable. The current
> behavior using realtime instead of monotime is surprising to us.
>
> It would be nice if $SECONDS was using `clock_gettime(CLOCK_MONOTONIC,
> &val)` as it would usually make the most sense when you want to know the
> time since the script started.

Even CLOCK_MONOTONIC can jump forward.  The only requirement is that it
doesn't jump backward.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

  • $SECONDS... William Kennington via Bug reports for the GNU Bourne Again SHell
    • Re:... Chet Ramey
      • ... William Kennington via Bug reports for the GNU Bourne Again SHell
        • ... Chet Ramey
          • ... Mike Jonkmans
    • Re:... Martin D Kealey
    • Re:... Andreas Schwab

Reply via email to