On Fri, 24 Mar 2023 at 10:42, William Kennington via Bug reports for the GNU Bourne Again SHell <bug-bash@gnu.org> wrote:
> 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. Generally new behaviour should have a new name, not overload an old name. So I suggest adding a new read-only variable BASH_CLOCK_MONOTONIC that reflects clock_gettime(CLOCK_MONOTONIC,...). (I would have it include fractional seconds, but that's a separate debate.) I have a specific reason for not wanting to change the behaviour of $SECONDS: I routinely set SECONDS so that it reflects the unix epoch time offset, usually by putting `printf -v SECONDS '%(%s)T'` in my scripts, and the proposed modification would break this. PS: Yes there are variables specifically for this in newer Bash versions, but to be able to run my scripts using older versions of Bash, this is by far the tidiest and cheapest approach.