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: References: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:16131 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