tai_from_utc

lsst.ts.utils.tai_from_utc(utc: float | str | Time, format: str | None = 'unix') float

Return TAI in unix seconds, given UTC or any astropy.time.Time.

Warning: smears time evenly on the day before a leap second. See Leap Second Smearing for details.

Because of the smearing, this function should only be used for scalar measures of UTC, such as unix seconds, Julian Date or Modified Julian Date. It should not be used for ISO-formatted date strings.

Parameters:
utcfloat, str or astropy.time.Time

UTC time in the specified format.

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

Returns:
tai_unixfloat

TAI time in unix seconds.

Raises:
ValueError

If the date is earlier than 1972 (which is before integer leap seconds) or within one day of the expiration date of the leap second table (which is automatically updated).

Notes

This function uses a leap second table that is automatically updated in the background (though updates are very infrequent).