From: Steven Baltakatei Sandoval Date: Tue, 7 Jul 2020 03:19:30 +0000 (+0000) Subject: fix(unitproc):timeEpochNS:Use ** for exponent X-Git-Tag: 0.3.0~46 X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/e061c448841eb607d27d59424c267b4d01c23a5f?hp=-c fix(unitproc):timeEpochNS:Use ** for exponent --- e061c448841eb607d27d59424c267b4d01c23a5f diff --git a/unitproc/bktemp-timeEpochNS b/unitproc/bktemp-timeEpochNS index b0e9a15..4c02f23 100644 --- a/unitproc/bktemp-timeEpochNS +++ b/unitproc/bktemp-timeEpochNS @@ -7,7 +7,7 @@ try() { "$@" || die "cannot $*"; } #o timeEpochNS() { # Desc: Get epoch nanoseconds # Usage: timeEpochNS - # Version 0.2.1 + # Version 0.2.2 # Input: arg1: 'date'-parsable timestamp string (optional) # Output: Nanoseconds since 1970-01-01 # Depends: date 8, yell() @@ -39,7 +39,7 @@ timeEpochNS() { TIME_EPOCH_FLOAT="$(date --date="$TIME_INPUT" +%s.%N)"; # Save ssss.NNNNNNNNN TIME_EPOCH_INT="$(echo "$TIME_EPOCH_FLOAT" | cut -d. -f1)"; # Get ssss TIME_EPOCH_NSFRAC="$(echo "$TIME_EPOCH_FLOAT" | cut -d. -f2)"; # Get NNNNNNNNN - TIME_EPOCH_NS="$(( (10#"$TIME_EPOCH_INT" * 1000000000) + (10#"$TIME_EPOCH_NSFRAC") ))"; + TIME_EPOCH_NS="$(( (10#"$TIME_EPOCH_INT" * 10**9) + (10#"$TIME_EPOCH_NSFRAC") ))"; echo "$TIME_EPOCH_NS"; } # Nanoseconds since 1970-01-01