Modify

Opened 4 years ago

Last modified 4 years ago

#17211 new enhancement

Add support for setting system clock from gps

Reported by: birger@… Owned by: developers
Priority: normal Milestone:
Component: packages Version: Trunk
Keywords: Cc:

Description

I have added one new option to /etc/config/gpsd:

option setclock "true"

And the following lines to /etc/init.d/gpsd:

config_get_bool setclock core setclock

.
.
.

[ "$setclock" != "1" ] && exit
NOW=gpspipe -l -w -n 10 | grep -m 1 "time" | sed -e 's/.*"time":"\(....\).\(..\).\(..\).\(........\).*/\1\.\2\.\3-\4/'
echo "Got date $NOW from GPS. Setting system time." > /dev/console
date "$NOW"

}

Does the GPS always find the time fast even if it can spend a long time getting a position fix? Or should this be forked off into a background thread? My Holux USB puck seems to always give me time in the first SKY sentences before it gets a fix and starts giving position data.

Of course there should also be a way to set this config variable in the GUI.

Attachments (0)

Change History (1)

comment:1 Changed 4 years ago by anonymous

To get a GPS fix, the device actually has to know the time. So that is one of the first things the GPS receiver is synchronizing.
One of my old GPS receivers only needed to see 1 satellite (not fix) and it would immediately report the correct time.

A better solution might be "chrony". There was some bug in the init script though, not sure if it's fixed.
Old chrony.conf from 2012:

logchange 0.5

cmdallow localhost
cmddeny

keyfile /etc/chrony/chrony.keys
commandkey 1

makestep 180 -1
refclock SHM 0 offset 0.0 delay 0.0

Add Comment

Modify Ticket

Action
as new .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.