Get total number of leap seconds relative to gps time

16 Ansichten (letzte 30 Tage)
user86753
user86753 am 13 Okt. 2022
Bearbeitet: David Hill am 13 Okt. 2022
I have a gps time stamp from a gps receiver, I'd like to convert that to GMT/UTC date and time.
GpsTime = 1667089162.11771
DayToSecs = 24*60*60;
TimeZero = datetime(1970,1,1, 'Format', 'd-MMM-y HH:mm:ss.SSS Z');
Tvec = GpsTime/DayToSecs + TdmsTimeZero;
Do I need to also adjust for leap seconds? If so, How do I return the total number of leap seconds from 'leapseconds' instead of the timetable?

Antworten (1)

David Hill
David Hill am 13 Okt. 2022
Bearbeitet: David Hill am 13 Okt. 2022
As long as the gps collection date is after 1 January 2017, then just subtract 18 seconds (37-19) see
Although your gps time seems to be in the future (not sure why).
GpsTime = 1667089162.11771;
utc=datetime(1980, 1, 6)+seconds(GpsTime-18);
utc=datetime(utc,'Format','yyyy-MM-dd HH:mm:ss.SSS')
utc = datetime
2032-11-03 00:19:04.117

Kategorien

Mehr zu Dates and Time finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by