From: Scott Worley Date: Sat, 31 May 2014 18:05:12 +0000 (-0700) Subject: Specify time_fmt more succinctly X-Git-Tag: v1.0.0~3 X-Git-Url: http://git.scottworley.com/keystroke-timestamps/commitdiff_plain/9aa98221c70b2c70997bfc5607b86b8602cfe73d?hp=-c Specify time_fmt more succinctly --- 9aa98221c70b2c70997bfc5607b86b8602cfe73d diff --git a/gaps.sh b/gaps.sh index cf95104..2d28af9 100755 --- a/gaps.sh +++ b/gaps.sh @@ -3,10 +3,7 @@ threshold=${1:-3600} LOGFILE="${2:-$HOME/keystroke-timestamps.log}" -awk -vthreshold="$threshold" ' - BEGIN { - time_fmt = "%F %T" - } +awk -vthreshold="$threshold" -vtime_fmt="%F %T" ' { if (prev && $1 - prev > threshold) { print(strftime(time_fmt, prev), "to", strftime(time_fmt, $1), "was", $1 - prev)