[ntp:questions] ntp & system without a rtc

folkert folkert at vanheusden.com
Mon May 13 17:53:29 UTC 2013


> >> > 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).

Yes. The program came part of http://www.vanheusden.com/ows/ which is a
program to collect access points in the streets which can then be
uploaded to http://www.openwlanmap.org/?lang=en (which is a public
service for finding your location when all you have is wifi
functionality).

> 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
> yet.

Yes, I check if the fix mode >= 2 and status != NO_FIX. Works like a
charm.


Folkert van Heusden

-- 
Nagios user? Check out CoffeeSaint - the versatile Nagios status
viewer! http://www.vanheusden.com/java/CoffeeSaint/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com


More information about the questions mailing list