mardi 18 août 2020

How to convert gps time to utc in c++?

I am collecting GPS time (in ns) from a sensor and I am looking for a way to convert that to a UTC time in C++.

I have a working code before in python.

    time_gps = time_gps * 10**(-9)    # Converts ns -> s
    gps_epoch = pd.datetime(year=1980, month=1, day=6)
    delta = pd.to_timedelta(time_gps, unit='s')
    time = gps_epoch + delta - pd.to_timedelta(19, unit='s')

I've been looking around for a conversion but can mostly find conversion in python. Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire