tai_from_utc¶
-
lsst.ts.salobj.tai_from_utc(utc, format='unix')¶ Return TAI in unix seconds, given UTC or any
astropy.time.Time.Parameters: - utc :
float,strorastropy.time.Time UTC time in the specified format.
- format :
strorNone Format of the UTC time, as an
astropy.timeformat name, orNoneto have astropy guess. Ignored ifutcis an instance ofastropy.time.Time.
Notes
Never use unix seconds if you need accuracy better than a second on the day of a leap second, because there is no standard for how to handle the computer clock. Both ntp and ptp can be configured to make the clock jump or smear in some way. https://developers.redhat.com/blog/2016/12/28/leap-second-i-belong-to-you/
Only use ISO date if you want the expected integer number of seconds between TAI and UTC on the day of a leap second.
On the day of a leap second
astropy.time(and the underlying Standards of Fundamental Astronomy library) shrink or stretch unix time, Julian Day and Modified Julian Day, as needed, so that exactly one day of standard length 86400 seconds elapses. This leads to TAI-UTC varying continuously on that day, instead of being an integer number of seconds. See https://github.com/astropy/astropy/issues/10055Also the
datetimelibrary does not handle leap seconds, and the datetime representation inastropy.timeraises an exception the date has 60 in the seconds field.- utc :