The unix_tai time format appears to be off by 8 seconds
See original GitHub issueDescription
The zero point for the new time format unix_tai
appears to be off by 8 seconds.
Expected behavior
The new time format unix_tai
is defined to match the CLOCK_TAI
Linux real-time clock (and I was looking forward to using it, for that reason).
For a current date I expect CLOCK_TAI - CLOCK_UTC = 37 seconds and that is what I observe on a linux system whose leap second table is properly maintained by ntp. When I try the same computation using Astropy I get 29 seconds.
Actual behavior
Astropy.time seems to believe that CLOCK_TAI - CLOCK_UTC is 29 seconds for current dates. That is what is shown as an example in your docs and is coded in the unit test, so you clearly have a reason for this. But I don’t see how it is compatible with CLOCK_TAI.
Steps to Reproduce
1: Find a linux system that has a current leap second table (linux is the only OS I know of that supports the CLOCK_TAI real time clock). 2: Use a reasonably recent Python 3 (I use 3.7) 3: Use AstroPy 4.1 or the current dev version
import time
import astropy.time
clock_tai = getattr(time, "CLOCK_TAI", 11)
now_utc_unix = time.time()
now_tai_unix = time.clock_gettime(clock_tai)
astropy_now_utc = astropy.time.Time(now_utc_unix, format="unix")
print(now_tai_unix - now_utc_unix)
print(astropy_now_utc.unix_tai - now_utc_unix)
System Details
import platform; print(platform.platform()) Linux-3.10.0-1062.12.1.el7.x86_64-x86_64-with-centos-7.7.1908-Core import sys; print(“Python”, sys.version) Python 3.7.8 | packaged by conda-forge | (default, Jul 23 2020, 03:54:19) [GCC 7.5.0] import numpy; print(“Numpy”, numpy.version) Numpy 1.19.1 import astropy; print(“astropy”, astropy.version) astropy 4.3.dev452+gc3132e70a import scipy; print(“Scipy”, scipy.version) Scipy 1.5.2 import matplotlib; print(“Matplotlib”, matplotlib.version) Matplotlib 3.0.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:26 (20 by maintainers)
Top GitHub Comments
In the end, I think we have to match
CLOCK_TAI
however that is actually implemented in current systems. Hopefully, those are consistent…I fear we need to go the “advertise as a breaking change route” - having two implementations is just going to be super-confusing.
@pllim I just meant which part of the Changelog I will fill in 😉
I am not a maintainer, so @mhvk or you will have to set the milestone.