lib/scripts/timestart.bash
changeset 18317 bab988e37393
child 18322 56554bb23eda
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/scripts/timestart.bash	Thu Dec 01 18:37:22 2005 +0100
     1.3 @@ -0,0 +1,21 @@
     1.4 +# -*- shell-script -*-
     1.5 +# $Id$
     1.6 +# Author: Makarius
     1.7 +#
     1.8 +# timestart - setup bash environment for timing.
     1.9 +#
    1.10 +
    1.11 +TIMES_RESULT=""
    1.12 +
    1.13 +#set by configure
    1.14 +AUTO_PERL=perl
    1.15 +
    1.16 +function get_times () {
    1.17 +  local TMP="/tmp/get_times$$"
    1.18 +  times > "$TMP"   # No pipe here!
    1.19 +  TIMES_RESULT="$SECONDS $(tail -1 "$TMP" | "$AUTO_PERL" -pe 's,(\d+)m(\d+)\.\d+s, $1 * 60 + $2,ge')"
    1.20 +  /bin/rm -f "$TMP"
    1.21 +}
    1.22 +
    1.23 +get_times  # sets TIMES_RESULT
    1.24 +