We've observed several times that GPS receivers would report a wrong
time/date directly after boot, probably assuming that their RTC is
Let's wait until the receiver reports it has a fix and reports actual
satellites were used to compute it.
In some cases, gpsd might die while we are waiting to receive a valid
fix/time information. In that case, we have to reconnect to gpsd
again and again, until a valid time has been received (and set as
This addresses and issue when gpsdate is running and the gpsd will be
killed (testing coredump handling).
The issue is within the libgps cod itself that doesn't handle the
result(0) of the recv syscall correctly and keeps on looping. Now in a
normal system gpsdate should only execute at the beginning and exit once
there is a date. So the window for this runtime failure is quite low.
Bug reported by Holger Freyther.