<?xml version="1.0" encoding="UTF-8"?>
<!-- **************************************************************************
.... For copyright and licensing terms, see the file named COPYING.
.... **************************************************************************
.-->
<?xml-stylesheet href="docbook-xml.css" type="text/css"?>

<refentry id="tai64nlocal">

<refmeta xmlns:xi="http://www.w3.org/2001/XInclude">
<refentrytitle>tai64nlocal</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">user commands</refmiscinfo>
<refmiscinfo class="source">djbwares</refmiscinfo>
<xi:include href="version.xml" />
</refmeta>

<refnamediv>
<refname>tai64nlocal</refname>
<refpurpose>converts precise TAI64N timestamps to a human-readable format.</refpurpose>
</refnamediv>

<refsynopsisdiv>
<cmdsynopsis>
<command>tai64nlocal</command>
</cmdsynopsis>
</refsynopsisdiv>

<refsection><title>Description</title>
<para>
<command>tai64nlocal</command> reads lines from stdin.
If a line does not begin with <computeroutput>@</computeroutput>, <command>tai64nlocal</command> writes it to stdout without change.
If a line begins with <computeroutput>@</computeroutput>, <command>tai64nlocal</command> looks for a timestamp after the <computeroutput>@</computeroutput>, in the format printed by <citerefentry><refentrytitle>tai64n</refentrytitle><manvolnum>1</manvolnum></citerefentry>, and writes the line to stdout with the timestamp converted to local time in ISO format: YYYY-MM-DD HH:MM:SS.SSSSSSSSS. 
</para>

<informalexample>
<para>
For example, in the US/Pacific time zone, the input line
<screen><computeroutput>@4000000037c219bf2ef02e94 mark</computeroutput></screen>
should be printed as 
<screen><computeroutput>1999-08-23 21:03:43.787492500 mark</computeroutput></screen>
</para>
</informalexample>

<para>
Beware, however, that the current implementation of <command>tai64nlocal</command> relies on the UNIX <citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>3</manvolnum></citerefentry> library routine to find the local time.
Some <code>localtime()</code> implementations use a broken time scale that does not account for leap seconds.
On systems that use the Olson tz library (with an up-to-date leap-second table), you can fix this problem by setting your time zone to, e.g, <code>right/US/Pacific</code> instead of <code>US/Pacific</code>.
</para>

<para>
Beware also that most <code>localtime()</code> implementations are not Y2038-compliant.
</para>

<para>
<command>tai64nlocal</command> does not allocate any memory after it starts, except possibly inside <code>localtime()</code>.
</para>
</refsection>

<refsection><title>Exit codes</title>
<para>
<command>tai64nlocal</command> exits 0 when it sees end of input.
It exits 111 without an error message if it has trouble reading stdin or writing stdout. 
</para>
</refsection>

<refsection><title>See also</title>
<variablelist>
<varlistentry><term><citerefentry><refentrytitle>supervise</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>svc</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>svok</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>svstat</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>svscanboot</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>svscan</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>readproctitle</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>fghack</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>pgrphack</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>multilog</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>tai64n</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>setuidgid</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>envuidgid</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>envdir</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>softlimit</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
<varlistentry><term><citerefentry><refentrytitle>setlock</refentrytitle><manvolnum>1</manvolnum></citerefentry></term></varlistentry>
</variablelist>
</refsection>

<refsection>
<title>Author</title>
<para>
Original code and documentation by <personname><firstname>Daniel</firstname> <othername>J.</othername> <surname>Bernstein</surname></personname>.
Converted to manual pages and updated by <personname><firstname>Gerrit</firstname> <surname>Pape</surname></personname> in 2000, 2001, and 2002. 
Converted to DocBook XML by <personname><firstname>Jonathan</firstname> <surname>de Boyne Pollard</surname></personname>.
</para>
</refsection>
</refentry>
