]> git.scottworley.com Git - keystroke-timestamps/commitdiff
Specify time_fmt more succinctly
authorScott Worley <scottworley@scottworley.com>
Sat, 31 May 2014 18:05:12 +0000 (11:05 -0700)
committerScott Worley <scottworley@scottworley.com>
Sat, 31 May 2014 18:05:12 +0000 (11:05 -0700)
gaps.sh

diff --git a/gaps.sh b/gaps.sh
index cf951049217ebf8e1e13fda0fb643612f728bc94..2d28af92a2cc6ba22d5fbb41325a2c28d546b8b0 100755 (executable)
--- a/gaps.sh
+++ b/gaps.sh
@@ -3,10 +3,7 @@
 threshold=${1:-3600}
 LOGFILE="${2:-$HOME/keystroke-timestamps.log}"
 
 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)
   {
     if (prev && $1 - prev > threshold) {
       print(strftime(time_fmt, prev), "to", strftime(time_fmt, $1), "was", $1 - prev)