mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-07 07:34:27 +01:00
metrics: Fix metrics ts generator to treat numbers as decimals
Use bc tool to perform math operations even when variables contain values with leading zero. Fixes: #7317 Signed-off-by: David Esparza <david.esparza.borquez@intel.com>
This commit is contained in:
@@ -22,7 +22,7 @@ timestamp_ns() {
|
||||
t="$(date +%-s:%-N)"
|
||||
s=$(echo $t | awk -F ':' '{print $1}')
|
||||
n=$(echo $t | awk -F ':' '{print $2}')
|
||||
ns=$(( (s * 1000000000) + n ))
|
||||
ns=$(echo "$s * 1000000000 + $n" | bc)
|
||||
|
||||
echo $ns
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user