author | wenzelm |
Fri, 31 Oct 2014 22:09:18 +0100 | |
changeset 58855 | 2885e2eaa0fb |
parent 58639 | 1df53737c59b |
permissions | -rw-r--r-- |
31310 | 1 |
# -*- shell-script -*- :mode=shellscript: |
29145 | 2 |
# |
18317 | 3 |
# Author: Makarius |
4 |
# |
|
5 |
# timestart - setup bash environment for timing. |
|
6 |
# |
|
7 |
||
8 |
TIMES_RESULT="" |
|
9 |
||
10 |
function get_times () { |
|
58639
1df53737c59b
prefer Unix standard-conformant $TMPDIR over hard-wired /tmp;
wenzelm
parents:
31310
diff
changeset
|
11 |
local TMP="${TMPDIR:-/tmp}/get_times$$" |
18317 | 12 |
times > "$TMP" # No pipe here! |
26576 | 13 |
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')" |
18327 | 14 |
rm -f "$TMP" |
18317 | 15 |
} |
16 |
||
17 |
get_times # sets TIMES_RESULT |