For those who may find this useful, I have adapted/written a short script that reads from 'gpsd' and sets the computer system date. If you don't have an RTC on your computer (Rasp Pi, Odroid, etc...) or access to a network and/or 'ntpd' (remote nomad operation), the script is useful to set the correct date and time for kstars. Normally the script should be started at boot time, after 'gpsd' is started but I am not sure where to put it (rc.local or other startup scripts).
It can be run manually using 'sudo' ( sudo /file/path/gps_set_date ) but making it automatic would be the best. Furthermore, as I haven't been writting scripts in a long long time, so improvements are welcome, and consideration for the timezone may be needed. See below for the script which works on my Odroid XU4Q running Ubuntu Mate 18.04 LTS, KStars 2.9.8, Ekos and INDI.
gps_set_date:
#!/bin/bash
if [ ! -e "/dev/gps0" ]
then
exit
else
GPSDATE=""
until [ "$GPSDATE" != "" ]; do
GPSDATE=`gpspipe -n 10 -w | grep TPV | grep -e '"mode":[23]' | grep '"time":' | sed -r 's/.*"time":"([^"]*)".*/\1/' | tail -1`
done
date --utc -s "$GPSDATE"
fi
It can be run manually using 'sudo' ( sudo /file/path/gps_set_date ) but making it automatic would be the best. Furthermore, as I haven't been writting scripts in a long long time, so improvements are welcome, and consideration for the timezone may be needed. See below for the script which works on my Odroid XU4Q running Ubuntu Mate 18.04 LTS, KStars 2.9.8, Ekos and INDI.
gps_set_date:
#!/bin/bash
if [ ! -e "/dev/gps0" ]
then
exit
else
GPSDATE=""
until [ "$GPSDATE" != "" ]; do
GPSDATE=`gpspipe -n 10 -w | grep TPV | grep -e '"mode":[23]' | grep '"time":' | sed -r 's/.*"time":"([^"]*)".*/\1/' | tail -1`
done
date --utc -s "$GPSDATE"
fi