]> git.scottworley.com Git - keystroke-timestamps/commitdiff
Add a script to show gaps
authorScott Worley <scottworley@scottworley.com>
Fri, 20 Sep 2013 15:33:31 +0000 (08:33 -0700)
committerScott Worley <scottworley@scottworley.com>
Fri, 20 Sep 2013 15:33:31 +0000 (08:33 -0700)
gaps.sh [new file with mode: 0755]

diff --git a/gaps.sh b/gaps.sh
new file mode 100755 (executable)
index 0000000..46a05cc
--- /dev/null
+++ b/gaps.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+threshold=${1:-3600}
+LOGFILE="$HOME/keystroke-timestamps.log"
+
+awk -vthreshold="$threshold" '
+  BEGIN {
+    time_fmt = "%F %T"
+  }
+  {
+    if (prev && $1 - prev > threshold) {
+      print(strftime(time_fmt, prev), "to", strftime(time_fmt, $1), "was", $1 - prev)
+    }
+    prev = $1
+  }' "$LOGFILE"