Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16131

Difference between EPOCHREALTIME and EPOCHSECONDS

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From felix@f-hauri.ch
Newsgroups gnu.bash.bug
Subject Difference between EPOCHREALTIME and EPOCHSECONDS
Date Tue, 14 Apr 2020 10:41:36 +0200
Lines 48
Approved bug-bash@gnu.org
Message-ID <mailman.245.1586869604.3066.bug-bash@gnu.org> (permalink)
References <E1jOH8S-0001Pc-VE@medium.hauri>
NNTP-Posting-Host lists.gnu.org
X-Trace usenet.stanford.edu 1586869604 22777 209.51.188.17 (14 Apr 2020 13:06:44 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash@gnu.org
Envelope-to bug-bash@gnu.org
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 212.74.161.16
X-Mailman-Approved-At Tue, 14 Apr 2020 09:06:43 -0400
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <E1jOH8S-0001Pc-VE@medium.hauri>
Xref csiph.com gnu.bash.bug:16131

Show key headers only | View raw


Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security
uname output: Linux medium 4.19.0-8-amd64 #1 SMP Debian 4.19.98-1 (2020-01-26) x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 5.0
Patch Level: 16
Release Status: release

Description:
        Integer part of $EPOCHREALTIME could increase more than 8000 microseconds
        before $EPOCHSECONDS

Repeat-By:
        epochVariableDiff () {
            local errcnt=0 lasterrcnt v1 v2 v3 us vals line
            while ((errcnt==0)) || ((errcnt>lasterrcnt)); do
                lasterrcnt=$errcnt
                printf -v vals '%(%s)T %s %s' -1 $EPOCHSECONDS $EPOCHREALTIME
                IFS=$' .' read v1 v2 v3 us <<<"$vals"
                [ "$v1" = "$v2" ] && [ "$v2" = "$v3" ] || ((errcnt++))
                [ $errcnt -eq 1 ] && echo "$line"
                printf -v line '%3d %s - %s - %s . %s' $errcnt $v1 $v2 $v3 $us
                printf "%s\r" "$line"
                ((errcnt)) && echo "$line"
                read -t ${1:-.0002}
            done

        epochVariableDiff
          0 1586853481 - 1586853481 - 1586853481 . 999940
          1 1586853481 - 1586853481 - 1586853482 . 000320
          2 1586853481 - 1586853481 - 1586853482 . 000691
          3 1586853481 - 1586853481 - 1586853482 . 001059
          4 1586853481 - 1586853481 - 1586853482 . 001429
          5 1586853481 - 1586853481 - 1586853482 . 001854
          6 1586853481 - 1586853481 - 1586853482 . 002220
          7 1586853481 - 1586853481 - 1586853482 . 002672
          8 1586853481 - 1586853481 - 1586853482 . 003113
          9 1586853481 - 1586853481 - 1586853482 . 003530
          9 1586853482 - 1586853482 - 1586853482 . 003889

        (My raspberry-pi seem not to be affected)

        Was discovered and published at https://stackoverflow.com/a/58557346/1765658

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Difference between EPOCHREALTIME and EPOCHSECONDS felix@f-hauri.ch - 2020-04-14 10:41 +0200

csiph-web