On Wed, Mar 29, 2023 at 10:49:00AM -0400, Chet Ramey wrote: > On 3/24/23 6:19 PM, William Kennington wrote: > > Not worried, it is legitimately a problem for us to the point we are > > currently patching bash to use the monotonic clock for seconds. It times > > out stuff in our boot process which executes normally after the time > > sync has completed and jumped the clock forward. Rght now, we are just > > patching bash until we can fix all of our uses of $SECONDS. I don't > > really have a preference for how this gets exposed (updating SECONDS to > > use the monotonic timer, adding a new variable like MONOSECONDS, or some > > other call to get monotonic time via clock_gettime). > > Interesting. I was wondering how you got onto this, so I looked around for > any utilities (e.g., timeout, sleep), library functions, or system calls > that use the monotonic clock and couldn't find any. It must be too `new'; > everyone seems to use the realtime clock. > > I'll take it as a feature request.
My earlier post, in help-bash: https://lists.gnu.org/archive/html/help-bash/2020-06/msg00031.html refers to a website pointing out problems with gettimeofday. That website was (presumably) written in 2010/09 : https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time.html So it is not that new. It is another special case in code, which may explain the slow uptake in tools, many of which need to be portable. -- Regards, Mike Jonkmans