]> git.scottworley.com Git - keystroke-timestamps/blobdiff - gaps.sh
Specify time_fmt more succinctly
[keystroke-timestamps] / gaps.sh
diff --git a/gaps.sh b/gaps.sh
index 46a05cc1f30af8d70162fce280b912e8e8e7e894..2d28af92a2cc6ba22d5fbb41325a2c28d546b8b0 100755 (executable)
--- a/gaps.sh
+++ b/gaps.sh
@@ -1,12 +1,9 @@
 #!/bin/bash
 
 threshold=${1:-3600}
 #!/bin/bash
 
 threshold=${1:-3600}
-LOGFILE="$HOME/keystroke-timestamps.log"
+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)