lib/scripts/timestart.bash
author wenzelm
Wed Dec 07 15:23:22 2005 +0100 (2005-12-07)
changeset 18364 a716d3b289ed
parent 18327 1ee4523c831f
child 26576 fc76b7b79ba9
permissions -rw-r--r--
avoid unportable tail;
wenzelm@18317
     1
# -*- shell-script -*-
wenzelm@18317
     2
# $Id$
wenzelm@18317
     3
# Author: Makarius
wenzelm@18317
     4
#
wenzelm@18317
     5
# timestart - setup bash environment for timing.
wenzelm@18317
     6
#
wenzelm@18317
     7
wenzelm@18317
     8
TIMES_RESULT=""
wenzelm@18317
     9
wenzelm@18317
    10
#set by configure
wenzelm@18317
    11
AUTO_PERL=perl
wenzelm@18317
    12
wenzelm@18317
    13
function get_times () {
wenzelm@18317
    14
  local TMP="/tmp/get_times$$"
wenzelm@18317
    15
  times > "$TMP"   # No pipe here!
wenzelm@18364
    16
  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')"
wenzelm@18327
    17
  rm -f "$TMP"
wenzelm@18317
    18
}
wenzelm@18317
    19
wenzelm@18317
    20
get_times  # sets TIMES_RESULT