lib/scripts/timestart.bash
author haftmann
Mon, 04 Nov 2019 20:38:15 +0000
changeset 71042 400e9512f1d3
parent 58639 1df53737c59b
permissions -rw-r--r--
proof-of-concept theory for bit operations without a constructivistic representation and a minimal common logical foundation

# -*- shell-script -*- :mode=shellscript:
#
# Author: Makarius
#
# timestart - setup bash environment for timing.
#

TIMES_RESULT=""

function get_times () {
  local TMP="${TMPDIR:-/tmp}/get_times$$"
  times > "$TMP"   # No pipe here!
  TIMES_RESULT="$SECONDS $(echo $(cat "$TMP") | perl -pe 's,\d+m\d+\.\d+s \d+m\d+\.\d+s (\d+)m(\d+)\.\d+s +(\d+)m(\d+)\.\d+s, $1 * 60 + $2 + $3 * 60 + $4,e')"
  rm -f "$TMP"
}

get_times  # sets TIMES_RESULT