[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: |
Mike Jonkmans |
Subject: |
Re: SECONDS=0 does not reset SECONDS, or I'm missing something |
Date: |
Fri, 5 Jun 2020 14:18:06 +0200 |
On Thu, Jun 04, 2020 at 02:34:35PM -0400, Chet Ramey 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.
Hi Chet,
Instead of gettimeofday, you might want to use
clock_gettime(CLOCK_MONOTONIC,..).
The problem with gettimeofday is described here:
https://blog.habets.se/2010/09/gettimeofday-should-never-be-used-to-measure-time.html
TL;DR gettimeofday may be inaccurate in combination with NTP.
Regards, Mike
--
Mike Jonkmans <bashbug@jonkmans.nl>
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, (continued)
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Chet Ramey, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Tim Visher, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/04
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Greg Wooledge, 2020/06/05
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Chet Ramey, 2020/06/05
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Greg Wooledge, 2020/06/05
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Andreas Kusalananda Kähäri, 2020/06/05
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Chet Ramey, 2020/06/05
- Re: SECONDS=0 does not reset SECONDS, or I'm missing something, Tim Visher, 2020/06/05
Re: SECONDS=0 does not reset SECONDS, or I'm missing something,
Mike Jonkmans <=