[ntp:questions] ntp & system without a rtc

Rob nomail at example.com
Mon May 13 08:33:23 UTC 2013

folkert <folkert at vanheusden.com> wrote:
>> >> How do you access the GPS receiver?  Via gpsd?
>> >
>> > Via gpsd indeed. But it that is a problem I can do other things first
>> > before I start gpsd.
>> No, with gpsd it is easier because you can connect the gpsd
>> port and ask it for the current time without having to worry
>> about parsing the gps data, sharing the serial port with other
>> applications, etc.
>> Just send a D command to gpsd, get and parse the reply and set the clock.
> Yeah that's what I did in the end. Only 10 lines of code using libgpsd.

I forgot to mention libgpsd but fortunately you located it and did
not have to write the code to connect gpsd (although that is pretty
simple in many script languages).

There also is some testing code included with gpsd that parses the
reply but then does nothing useful with it.  That might have been an
even easier starting point (only an stime call needs to be added).

Of course some error handling won't hurt, in case the GPS has no lock

More information about the questions mailing list