title: What is the epoch of CLOCK_TAI?
body: <p>Since Linux kernel version 3.10, the function <code>clock_gettime()</code> now accept <code>CLOCK_TAI</code>. </p>
  
  <p>I didn't manage to find a detailed description of this clock. What is its epoch ? </p>
  
  <p><strong>EDIT 1</strong>: Just compared the output of CLOCK_REALTIME and CLOCK_TAI on my Linux 3.19 OS and it returns the exact same value (1442582497) !? Is CLOCK_REALTIME decremented at leap seconds ?</p>
  
  <p><strong>EDIT 2</strong>: According to <a href="http://developerblog.redhat.com/2015/06/01/five-different-ways-handle-leap-seconds-ntp/" rel="nofollow noreferrer">this article</a>, the difference between CLOCK_TAI and the (badly named) CLOCK_REALTIME should be the number of leap seconds. </p>
  
  <p><strong>EDIT 3</strong>: The reason <code>CLOCK_TAI</code> and <code>CLOCK_REALTIME</code> are the same time is explained in the article referenced in Edit 2. The emphasis is by me.</p>
  
  <blockquote>
    <p>For applications where it would be possible to work with TAI time instead of UTC, the kernel provides a special CLOCK_TAI clock which does include leap seconds and doesn’t need to be corrected after leap second, avoiding the problem with backward jump in the time entirely. It’s implemented as a clock running at a fixed integral offset to CLOCK_REALTIME, which is atomically incremented by 1 when the CLOCK_REALTIME clock is stepped back on leap second. It was introduced in the Linux kernel version 3.10 and is available with the kernels shipped in RHEL7. <strong>Please note that the offset from CLOCK_REALTIME is initialized on boot to zero and neither ntpd nor chronyd set it by default to the correct value (currently 35).</strong> Switching to CLOCK_TAI in applications would of course require modifications to the code and possibly also all protocols that use the Unix representation of time.</p>
  </blockquote>
  
  <p><strong>Edit 4</strong> : <a href="https://askubuntu.com/a/675644/15352">This answer</a> obtained on Ask Ubuntu clarifies everything. </p>