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, str or astropy.time.Time

UTC time in the specified format.

format : str or None

Format of the UTC time, as an astropy.time format name, or None to have astropy guess. Ignored if utc is an instance of astropy.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/10055

Also the datetime library does not handle leap seconds, and the datetime representation in astropy.time raises an exception the date has 60 in the seconds field.