Re: Seeking clarifaction of tai64nlocal and leap seconds

Russ Allbery <[email protected]> Wed, 19 Sep 2012 23:24:49 -0700
Newsgroups gmane.comp.djb.syslog
Organization The Eyrie
Message-ID <[email protected]>
"Andy Bradford" <[email protected]>
writes:
> Thus said Russ Allbery on Wed, 19 Sep 2012 14:52:15 PDT:

>> Hm. The more I think about it, the more I'm guessing that's the case:
>> that you only get TAI timestamps from multilog if you've configured
>> your system clock to be in TAI and are using the "right" tz zone files.

> I am not using the ``right'' TZ zone files, and yet:

> $ date | tai64n | tai64nlocal
> 2012-09-19 20:20:29.968499500 Wed Sep 19 20:20:29 MDT 2012

> $ ls -l /etc/localtime 
> lrwxr-xr-x  1 root  wheel  31 Dec 29  2010 /etc/localtime@ -> /usr/share/zoneinfo/US/Mountain

> Not surprising given that the documentation does say it uses
> gettimeofday(). I believe the ``right'' zones are only needed if your
> clock is synchronized with a TAI clock. Most clocks are not.

I'm pretty sure that that's just because there are symmetric errors.  I
think you'd find that the timestamp that's stored is UTC, not TAI, but
since your local timezone isn't the "right" zone, it doesn't do the
correction for TAI when converting it back to the human-readable time, and
so you end up with the right result.

All of which is perfectly fine if you're just using the timestamps for
display or know what you're dealing with, but I suspect that if you used
the timestamp as TAI, you'd be surprised.

I could be misunderstanding this, though.

-- 
Russ Allbery ([email protected])             <http://www.eyrie.org/~eagle/>