Skip lines that are greater than
67767976233561595
Sometimes this happens if keystroke-timestamps is killed without
flushing, such as by SIGKILL or loss of power. When this happens,
it can write a partial line. When the next run starts up, it
appends a timestamp to the partial line, resulting in a timestamp
too large for awk to process.
GNU awk's end-of-time behavior:
$ f() { awk '{ print strftime("%F %T", $1) }' <<< "$1"; }
$ f
67767976233561595
2147483647-12-31 23:59:52
$ f
67767976233561596
-
2147483648-01-01 00:00:00
$ f
67768036191705595
-
2147481749-12-31 23:59:52
$ f
67768036191705596
awk: cmd. line:1: (FILENAME=- FNR=1) fatal error: internal error
Aborted
Only print to-the-second resolution by default.
Put microseconds behind a flag.
This makes it harder to do timing analysis on the log file to try to
turn this into a keylogger.
(More precise timing information is still available to an on-line attack
by watching the flush timings or by watching the CPU usage and run state
of the process.)