import os import sys import time from gps import * print 'Attempting to access GPS time...' try: gpsd = gps(mode=WATCH_ENABLE) except: print 'No GPS connection present. TIME NOT SET.' sys.exit() while True: gpsd.next() if gpsd.utc != None and gpsd.utc != '': gpstime = gpsd.utc[0:4] + gpsd.utc[5:7] + gpsd.utc[8:10] + ' ' + gpsd.utc[11:19] print 'Setting system time to GPS time...' os.system('sudo date -u --set="%s"' % gpstime) print 'System time set.' sys.exit() time.sleep(1)
petarm wrote: Hi Kaczorek, yep i did all that, gpsmon in a terminal tells me the gps adapter is connect and working and acquiring gps data. But when i then run gpsd in kstars/ekos, it was not populating UTC, it was using the time from the asus tinker board.
It's a feature not a bug
GPSD driver gets time from the system not from gps directly. The reason is noted in the comments in the source code:// Update time regardless having gps fix. // We are using system time assuming the system is synced with the gps // by gpsd using chronyd or ntpd.