s6-portable-utils: the s6-tai64ndiff program
Keywords: s6 command s6-tai64ndiff filter timestamp TAI64 TAI64N diff time difference log line

s6-portable-utils
Software
skarnet.org

# The s6-tai64ndiff program

s6-tai64ndiff acts as a filter, reading from stdin and writing to stdout. It expects every line of its input to begin with a TAI64N timestamp. It replaces this timestamp with a prefix showing the time difference between this line and the previous line.

## Interface

         s6-tai64ndiff

- s6-tai64ndiff exits 0 when it sees the end of stdin. If there's an unfinished line, s6-tai64ndiff processes it and writes it before exiting.
- The prefix it prints is of the form `[ seconds.microseconds ]`, in decimal. It can be interpreted as a fixed-point decimal number of seconds that elapsed between the timestamp on the previous line and the timestamp on the current line.
- If the difference isn't defined, seconds and microseconds are just whitespace. The difference is not defined on the first line of stdin or on non-timestamped lines. Following non-timestamped lines, the difference may not be accurate.

## Notes

- The typical use case of s6-tai64ndiff is to read files that have been filtered through s6-tai64n, or log files that have been produced by s6-log with the `t` directive.
- The difference is a signed number. Negative numbers probably indicate a backwards clock jump, which is a bad thing to have on a system.