lib/scripts/timestart.bash
author nipkow
Wed, 04 Mar 2009 10:47:20 +0100
changeset 30235 58d147683393
parent 29145 b1c6f4563df7
child 31310 b5365a9db718
permissions -rw-r--r--
Made Option a separate theory and renamed option_map to Option.map

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

TIMES_RESULT=""

function get_times () {
  local TMP="/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