tests/test_util: Fix wrong argument in delta

This spewed errors because the `math` invocation got no second
operand:

    Testing file checks/sigint.fish ... math: Error: Too few arguments
    '1571487730 -'

but only if the `date` didn't do milliseconds, which is the case on
FreeBSD and NetBSD.

(also force the variable to be global - we don't want to have a
universal causing trouble here)
This commit is contained in:
Fabian Homborg 2019-10-19 14:25:03 +02:00
parent fc0c39b6fd
commit e0d623d4b7

View File

@ -137,7 +137,7 @@ end
# lame timer
for program in {g,}date
if command -q $program && $program --version 1>/dev/null 2>/dev/null
set milli $program
set -g milli $program
set unit ms
break
else
@ -154,5 +154,5 @@ end
function delta
set -q milli[1]
and math "( "($milli +%s%3N)" - $argv[1])"
or math (date +%s) - $starttime
or math (date +%s) - $argv[1]
end