gpstime.leaps module

class gpstime.leaps.LeapData(path)[source]

Bases: object

Leap second data class

as_gps()[source]

Returns leap second data with times represented as GPS.

as_unix(since_gps_epoch=False)[source]

Return leap second data with times represented as UNIX.

If since_gps_epoch is set to True, only return leap second data since the GPS epoch (1980-01-06T00:00:00Z).

property data

Return leap second data with times represented as UNIX.

property expired

True if leap second data is expired

property valid

True if leap second data is available and not expired

gpstime.leaps.find_leap_data(download=None)[source]

Find leap second data

System and user cache locations will be searched. If a local file is not found, one will be downloaded from the canonical online source.

There are three options for the download argument:

True: System leap data will be ignored and the leap data file will

be downloaded from the remote source.

False: Only system leap data will used.

None (default): The first available leap data will be used, and it

will be downloaded if the system leap data is not available or invalid.

Downloaded leap data will be stored in the local user cache directory.

gpstime.leaps.load_IANA(path)[source]

Parse the leapseconds file format used by IANA.

gpstime.leaps.load_IERS(path)[source]

Parse the leap-seconds.list file format used by NIST, IERS, and IETF.

gpstime.leaps.ntp2unix(ts)[source]

Convert NTP timestamp to UTC UNIX timestamp

1900-01-01T00:00:00Z -> 1970-01-01T00:00:00Z