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;
     1 # -*- shell-script -*-
     2 # $Id$
     3 # Author: Makarius
     4 #
     5 # timestart - setup bash environment for timing.
     6 #
     7 
     8 TIMES_RESULT=""
     9 
    10 #set by configure
    11 AUTO_PERL=perl
    12 
    13 function get_times () {
    14   local TMP="/tmp/get_times$$"
    15   times > "$TMP"   # No pipe here!
    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')"
    17   rm -f "$TMP"
    18 }
    19 
    20 get_times  # sets TIMES_RESULT