diff options
Diffstat (limited to 'util/bin/timer')
-rwxr-xr-x | util/bin/timer | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/util/bin/timer b/util/bin/timer index 98c43063..0ccf514a 100755 --- a/util/bin/timer +++ b/util/bin/timer @@ -1,14 +1,14 @@ #!/bin/bash - +curr=$(date '+%s%N') +etime=${curr:0:${#curr}-6} if [[ $# -eq 0 ]];then - echo $(date '+%s') + echo $etime 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" + [ "$1" == "-h" -o "$1" == "--help" ] && \ + echo "usage: $0 [start_ms]" && \ + echo " if no start_ms is given, return the currentime" && \ + echo " if start_ms is given, return the difference" && exit 0 stime=$1 - etime=$(date '+%s') [[ -z "$stime" ]] && stime=$etime echo $((etime - stime)) fi |