lib/scripts/timestart.bash
author krauss
Tue, 06 Jun 2006 09:28:24 +0200
changeset 19782 48c4632e2c28
parent 18364 a716d3b289ed
child 26576 fc76b7b79ba9
permissions -rw-r--r--
HOL/Tools/function_package: imporoved handling of guards, added an example

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

TIMES_RESULT=""

#set by configure
AUTO_PERL=perl

function get_times () {
  local TMP="/tmp/get_times$$"
  times > "$TMP"   # No pipe here!
  TIMES_RESULT="$SECONDS $(echo $(cat "$TMP") | "$AUTO_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