diff options
| author | EUcancER <root@euer.krebsco.de> | 2012-06-01 14:51:31 +0200 | 
|---|---|---|
| committer | EUcancER <root@euer.krebsco.de> | 2012-06-01 14:51:31 +0200 | 
| commit | 6deac5efc1c0207d71006a7941c74f66a0bc0a2f (patch) | |
| tree | 0e1b1bf464d4550f7262d2a3259520fd030f1e1a /util/bin | |
| parent | 1e2f845e906e9290997365661fa6c753e3868702 (diff) | |
add timer util
Diffstat (limited to 'util/bin')
| -rwxr-xr-x | util/bin/timer | 14 | 
1 files changed, 14 insertions, 0 deletions
diff --git a/util/bin/timer b/util/bin/timer new file mode 100755 index 00000000..98c43063 --- /dev/null +++ b/util/bin/timer @@ -0,0 +1,14 @@ +#!/bin/bash + +if [[ $# -eq 0 ]];then +  echo $(date '+%s') +else +  [ "$1" -eq "-h" -o "$1" -eq "--help" ] && \ +    echo "usage: $0 [start_time]" && \ +    echo "  if no start_time is given, return the currentime" && \ +    echo "  if start_time is given, return the difference" +  stime=$1 +  etime=$(date '+%s') +  [[ -z "$stime" ]] && stime=$etime +  echo $((etime - stime)) +fi  | 
