Easy way to get the International Atomic Time on linux?

There is work in progress to give Linux native support for TAI. Until then, you can use scheme-clock to convert to TAI.


The answer with the "right/" timezone is incorrect. It is meant to convert from a system clock kept in TAI - 10s to UTC. Thus, the following gives the correct time in UTC, GPS, LOREN and TAI [1]:

#!/bin/sh
echo -n "UTC:   "; TZ='UTC' date
echo -n "GPS:   "; TZ='UTC' date --date='TZ="../leaps/UTC" now -9 seconds'
echo -n "LORAN: "; TZ='UTC' date --date='TZ="../leaps/UTC" now'
echo -n "TAI:   "; TZ='UTC' date --date='TZ="../leaps/UTC" now 10 seconds'

The right timezones might be at a different location, TZ="right/UTC", TZ="../zoneinfo-leaps/UTC". Replace "now" with the date/time you want to transform - the output is correct for every date after 1/1/1980.

Output:

UTC:   Sun Oct 30 16:28:30 UTC 2016
GPS:   Sun Oct 30 16:28:47 UTC 2016
LORAN: Sun Oct 30 16:28:56 UTC 2016
TAI:   Sun Oct 30 16:29:06 UTC 2016

[1] http://www.leapsecond.com/java/gpsclock.htm


Answer is Deprecated: see https://serverfault.com/a/812163/67419

You could use the "right/" timezone to display an approximation (<1s) of the TAI.

But you need to make sure that your timezone package is up-to-date (e.g. tzdata on Ubuntu).

Code:

TZ='right/UTC' date

Example:

$ date -u ; TZ='right/UTC' date
Mon Sep 16 13:36:21 UTC 2013
Mon Sep 16 13:35:56 UTC 2013

Reason for depreciation: between 2013 and today, the timezone "right/UTC" corresponds to TAI - 10 seconds and not TAI. Or there was a bug.