My system uses UTC for the system clock, which I don't particularly feel like changing. Is there an easy way to get the current TAI time? (preferably a command line tool or flag)

  • 2
    Do you want to get the difference between UTC and TAI for informational purposes (e.g. it's 12:30:13 UTC and 12:30:45 TAI) or do you want to reset the clock from an external source to make up for accumulated differences on your local system?
    – Sven
    Jul 5 '12 at 19:58
  • 1
    At the moment just for informational purposes. And in case I ever want to use it in programming, since TAI, unlike UTC, is always monotonically increasing
    – JanKanis
    Jul 6 '12 at 9:19

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

  • Hmm, so there's not any easy support currently, but kernel support is coming and then we just need to wait for userland utilities to support the CLOCK_TAI option.
    – JanKanis
    Jul 10 '12 at 9:52

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]:

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.


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

  • Indeed you are correct about my answer. As you can see from the copied example, in 2013 it used to work. However, today in 2017 I have 10 seconds difference between TAI and what TZ='right/UTC' date is printing.
    – Huygens
    Jun 19 '17 at 10:01
  • PLEASE NOTE: UTC is adjusted with respect to GPS and TAI when leap-seconds are updated. TAI (Temps Atomique International, is the international atomic time scale based on a continuous counting of the SI second). In 2019 TAI is ahead of UTC by 37 seconds. TAI is always ahead of GPS by 19 seconds. Any system using this must be updated, to keep "../leaps/UTC" up-to-date.
    – KevinM
    Oct 2 '19 at 6:26

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).


TZ='right/UTC' date


$ 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.

  • This is also going the "wrong direction", TAI time is ahead of UTC - not behind it. You need to do something like this instead: date -u -d @$(TZ='right/UTC' date --date="$(TZ="posix/UTC" date -d "now + 10 seconds")" +%s)
    – Compholio
    Oct 25 at 16:43

It's easy to do: just run /usr/sbin/ntpdate pool.ntp.org;/sbin/hwclock --systohc once or add it to cron. I have it set to daily.

  • 1
    Better use something like pool.ntp.org instead of a fixed IP address to load balance the service better.
    – Sven
    Jul 5 '12 at 19:59
  • 4
    also the authors of ntpdate label it as unmaintained, obsolete, and deprecated. People are encouraged to use ntpd and ntp-wait instead. Its better to just have your clock always correct than have it suddenly jump to the correct time periodically.
    – stew
    Jul 5 '12 at 20:00
  • 4
    I think NTP issues the UTC time, not TAI time which I specifically asked for.
    – JanKanis
    Jul 6 '12 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.