tai4nlocal 1 user commands nosh
tai64nlocal filter to translate external TAI64N timestamps
`tai64nlocal` files

## Description

`tai64nlocal` reads a series of lines. For each line that begins with an `@` character and a TAI64N timestamp in external form (16 hexadecimal digits of seconds and 8 hexadecimal digits of nanoseconds) it replaces the timestamp with a broken down calendar date and time in human-readable form.

If no files are supplied, `tai64nlocal` reads from its standard input until EOF. Otherwise it processes each named file in turn. In both cases it writes to its standard output.

A trailing newline is silently added to any file (or to standard input) that ends with a partial line.

`tai64nlocal` treats TAI64N timestamps correctly. On a Linux system where it detects an Olson "right" timezone currently in use, it knows that the system clock is TAI seconds since the Epoch and performs a simple conversion to determine system clock time. On other Linux systems, and on BSDs, it assumes that the system clock is UTC seconds since the Epoch and attempts to correct for (known) UTC leap seconds in order to determine UTC system clock time.

`tai64nlocal` uses the C/C++ runtime library for output, and therefore has the normal C/C++ stream buffering semantics. It uses the read 2 library function for input, however. To duplicate the GNU and BSD C/C++ runtime libraries' behaviours, it explicitly flushes the output's buffer whenever it is about to read more input and that input is the beginning of a new line.

## Compatibility

The daemontools and daemontools-encore tai64nlocal 1 both have a bug that causes them to crash if the input contains a line beginning with an `@` character but not having a properly encoded TAI64N timestamp, or having a TAI64N timestamp outwith the range acceptable to the localtime 1 library function. `tai64nlocal` does not replicate this bug.

See the timestamps section of the nosh Guide for detailed information on the differences from daemontools, daemontools-encore, and other toolsets in how `tai64nlocal` handles TAI.

## Author

Jonathan de Boyne Pollard