Sample Header Ad - 728x90

Setting time through GPS dongle

4 votes
2 answers
8111 views
There is this code that claims to set the time of your Linux environment, http://blog.petrilopia.net/linux/raspberry-pi-set-time-gps-dongle/ date -s '01/01/2014 00:01' sleep 1 pkill ntpd pkill gpsd gpsd -b -n -D 2 /dev/ttyUSB0 sleep 2 GPSDATE=gpspipe -w | head -10 | grep TPV | sed -r 's/.*"time":"([^"]*)".*/\1/' | head -1 echo $GPSDATE date -s "$GPSDATE" /usr/sbin/ntpd But When I am running this code through puTTy it sets my time to, > Sun Aug 8 06:08:11 PKT 2010 I'd like to know why it is setting my GPS time to 2010 while its 2013. Here is the Output of gpspipe -w command {"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:53.020Z","ept":0.005} {"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:54.020Z","ept":0.005} {"class":"SKY","tag":"MID4","device":"/dev/ttyUSB0","time":"1990-12-22T23:59:55.010Z"} {"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:55.010Z","ept":0.005} {"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:56.020Z","ept":0.005} {"class":"TPV","tag":"MID2","device":"/dev/ttyUSB0","mode":1,"time":"1990-12-22T23:59:57.020Z","ept":0.005} The output is continuous, which means it is changing every second.
Asked by Sufiyan Ghori (262 rep)
Oct 23, 2013, 09:13 AM
Last activity: Sep 24, 2016, 09:44 PM