diff options
-rw-r--r-- | gpsd.c | 9 | ||||
-rw-r--r-- | gpsd.xml | 9 |
2 files changed, 16 insertions, 2 deletions
@@ -158,6 +158,7 @@ static bool nowait = false; #else /* FORCE_NOWAIT */ #define NOWAIT true #endif /* FORCE_NOWAIT */ +static bool batteryRTC = false; static jmp_buf restartbuf; static struct gps_context_t context; #if defined(SYSTEMD_ENABLE) @@ -1548,8 +1549,9 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed) */ if ((changed & TIME_SET) == 0) { //gpsd_log(&context.errout, LOG_PROG, "NTP: No time this packet\n"); - } else if ( NTP_MIN_FIXES > device->fixcnt ) { + } else if ( 0 >= device->fixcnt && !batteryRTC ) { /* many GPS spew random times until a valid GPS fix */ + /* allow override with -r optin */ //gpsd_log(&context.errout, LOG_PROG, "NTP: no fix\n"); } else if (isnan(device->newdata.time)) { //gpsd_log(&context.errout, LOG_PROG, "NTP: bad new time\n"); @@ -1872,7 +1874,7 @@ int main(int argc, char *argv[]) #endif /* PPS_ENABLE && SOCKET_EXPORT_ENABLE */ #endif /* CONTROL_SOCKET_ENABLE */ - while ((option = getopt(argc, argv, "F:D:S:bGhlNnP:V")) != -1) { + while ((option = getopt(argc, argv, "F:D:S:bGhlNnrP:V")) != -1) { switch (option) { case 'D': context.errout.debug = (int)strtol(optarg, 0, 0); @@ -1909,6 +1911,9 @@ int main(int argc, char *argv[]) nowait = true; #endif /* FORCE_NOWAIT */ break; + case 'r': + batteryRTC = true; + break; case 'P': pid_file = optarg; break; @@ -33,6 +33,7 @@ BSD terms apply: see the file COPYING in the distribution root for details. <arg choice='opt'>-n </arg> <arg choice='opt'>-N </arg> <arg choice='opt'>-h </arg> + <arg choice='opt'>-r </arg> <arg choice='opt'>-P <replaceable>pidfile</replaceable></arg> <arg choice='opt'>-D <replaceable>debuglevel</replaceable></arg> <arg choice='opt'>-V </arg> @@ -203,6 +204,14 @@ This switch is mainly useful for debugging.</para> <listitem><para>Display help message and terminate.</para></listitem> </varlistentry> <varlistentry> +<term>-r</term> +<listitem><para>Use GPS time even with no current fix. Some GPS's have +battery powered Real Time Clocks (RTC's) built in, makeing them a valid time +source even before a fix is acquired. This can be useful on a Raspberry Pi, +or other device that has no battery powered RTC, and thus has no valid +time at startup.</para></listitem> +</varlistentry> +<varlistentry> <term>-P</term> <listitem> <para>Specify the name and path to record the daemon's process ID.</para> |