summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gps.h18
-rw-r--r--gpsd.c10
-rw-r--r--gpsmon.c20
-rw-r--r--libgps_json.c12
-rw-r--r--libgpsd_core.c2
-rw-r--r--monitor_nmea0183.c6
-rw-r--r--monitor_sirf.c8
-rw-r--r--monitor_ubx.c6
-rw-r--r--ntpshm.c6
-rw-r--r--ppsthread.c32
10 files changed, 64 insertions, 56 deletions
diff --git a/gps.h b/gps.h
index 748c723c..3e49b368 100644
--- a/gps.h
+++ b/gps.h
@@ -1884,7 +1884,7 @@ struct policy_t {
char remote[GPS_PATH_MAX]; /* ...if this was passthrough */
};
-struct timedrift_t {
+struct timedelta_t {
struct timespec real;
struct timespec clock;
};
@@ -1955,8 +1955,8 @@ struct gps_data_t {
#define POLICY_SET (1llu<<29)
#define LOGMESSAGE_SET (1llu<<30)
#define ERROR_SET (1llu<<31)
-#define TIMEDRIFT_SET (1llu<<32)
-#define PPSDRIFT_SET (1llu<<33)
+#define TOFF_SET (1llu<<32) /* not yet used */
+#define PPS_SET (1llu<<33)
#define SET_HIGH_BIT 34
timestamp_t online; /* NZ if GPS is on line, 0 if not.
*
@@ -2006,7 +2006,7 @@ struct gps_data_t {
} devices;
/* pack things never reported together to reduce structure size */
-#define UNION_SET (RTCM2_SET|RTCM3_SET|SUBFRAME_SET|AIS_SET|ATTITUDE_SET|GST_SET|VERSION_SET|LOGMESSAGE_SET|ERROR_SET|TIMEDRIFT_SET)
+#define UNION_SET (RTCM2_SET|RTCM3_SET|SUBFRAME_SET|AIS_SET|ATTITUDE_SET|GST_SET|VERSION_SET|LOGMESSAGE_SET|ERROR_SET|TOFF_SET|PPS_SET)
union {
/* unusual forms of sensor data that might come up the pipe */
struct rtcm2_t rtcm2;
@@ -2019,13 +2019,21 @@ struct gps_data_t {
/* "artificial" structures for various protocol responses */
struct version_t version;
char error[256];
- struct timedrift_t timedrift;
+ struct timedelta_t pps;
};
/* Private data - client code must not set this */
void *privdata;
};
+/*
+ * Preserve source compatibility with 6.0 (version 3.12).
+ * Can go away on next object file bump.
+ */
+#define timedrift_t timedelta_t
+#define timedelta pps
+#define PPSDRIFT_SET PPS_SET
+
extern int gps_open(/*@null@*/const char *, /*@null@*/const char *,
/*@out@*/struct gps_data_t *);
extern int gps_close(struct gps_data_t *);
diff --git a/gpsd.c b/gpsd.c
index 7f4291fb..cb19a088 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1523,7 +1523,7 @@ static void all_reports(struct gps_device_t *device, gps_mask_t changed)
//gpsd_report(&context.errout, LOG_PROG, "NTP: No precision time report\n");
} else if (device->shm_clock != NULL) {
/*@-compdef@*/
- struct timedrift_t td;
+ struct timedelta_t td;
ntpshm_latch(device, &td);
(void)ntpshm_put(device, device->shm_clock, &td);
/*@+compdef@*/
@@ -1650,9 +1650,9 @@ static int handle_gpsd_request(struct subscriber_t *sub, const char *buf)
#endif /* SOCKET_EXPORT_ENABLE */
#if defined(CONTROL_SOCKET_ENABLE) && defined(PPS_ENABLE) && defined(SOCKET_EXPORT_ENABLE)
-static void ship_pps_drift_message(struct gps_device_t *session,
- struct timedrift_t *td)
-/* on PPS interrupt, ship a drift message to all clients */
+static void ship_pps_message(struct gps_device_t *session,
+ struct timedelta_t *td)
+/* on PPS interrupt, ship a message to all clients */
{
/*@-type@*//* splint is confused about struct timespec */
notify_watchers(session, true, true,
@@ -1798,7 +1798,7 @@ int main(int argc, char *argv[])
#ifdef CONTROL_SOCKET_ENABLE
INVALIDATE_SOCKET(csock);
#if defined(PPS_ENABLE) && defined(SOCKET_EXPORT_ENABLE)
- context.pps_hook = ship_pps_drift_message;
+ context.pps_hook = ship_pps_message;
#endif /* PPS_ENABLE && SOCKET_EXPORT_ENABLE */
#endif /* CONTROL_SOCKET_ENABLE */
diff --git a/gpsmon.c b/gpsmon.c
index a6d801c6..d4375c09 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -661,7 +661,7 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED)
{
char buf[BUFSIZ];
#ifdef NTPSHM_ENABLE
- struct timedrift_t td;
+ struct timedelta_t td;
#endif /* NTPSHM_ENABLE */
#if defined(SOCKET_EXPORT_ENABLE) && defined(PPS_ENABLE) && defined(CONTROL_SOCKET_ENABLE)
@@ -679,23 +679,23 @@ static void gpsmon_hook(struct gps_device_t *device, gps_mask_t changed UNUSED)
} else {
/*@-type -noeffect@*/ /* splint is confused about struct timespec */
struct timespec timedelta;
- TS_SUB( &timedelta, &noclobber.timedrift.real,
- &noclobber.timedrift.clock);
+ TS_SUB( &timedelta, &noclobber.pps.real,
+ &noclobber.pps.clock);
if (!curses_active)
(void)fprintf(stderr,
- "Drift clock=%ld.%09ld clock=%ld.%09ld offset=%ld.%09ld\n",
- (long)noclobber.timedrift.clock.tv_sec,
- (long)noclobber.timedrift.clock.tv_nsec,
- (long)noclobber.timedrift.real.tv_sec,
- (long)noclobber.timedrift.real.tv_nsec,
+ "PPS=%ld.%09ld clock=%ld.%09ld offset=%ld.%09ld\n",
+ (long)noclobber.pps.clock.tv_sec,
+ (long)noclobber.pps.clock.tv_nsec,
+ (long)noclobber.pps.real.tv_sec,
+ (long)noclobber.pps.real.tv_nsec,
(long)timedelta.tv_sec,
(long)timedelta.tv_nsec);
/*@+type +noeffect@*/
(void)strlcpy(buf, PPSBAR, sizeof(buf));
/* coverity[missing_lock] */
- session.ppslast = noclobber.timedrift;
+ session.ppslast = noclobber.pps;
/* coverity[missing_lock] */
session.ppscount++;
}
@@ -1037,7 +1037,7 @@ static bool do_command(const char *line)
#ifdef PPS_ENABLE
static /*@observer@*/ char *pps_report(struct gps_device_t *session UNUSED,
- struct timedrift_t *td UNUSED) {
+ struct timedelta_t *td UNUSED) {
packet_log(PPSBAR);
return "gpsmon";
}
diff --git a/libgps_json.c b/libgps_json.c
index 156ddf1b..c9a35363 100644
--- a/libgps_json.c
+++ b/libgps_json.c
@@ -370,7 +370,7 @@ int json_pps_read(const char *buf, struct gps_data_t *gpsdata,
/*@ +fullinitblock @*/
int status;
- memset(&gpsdata->timedrift, '\0', sizeof(gpsdata->timedrift));
+ memset(&gpsdata->pps, '\0', sizeof(gpsdata->pps));
status = json_read_object(buf, json_attrs_pps, endptr);
/*
* This is theoretically dodgy, but in practice likely not
@@ -378,10 +378,10 @@ int json_pps_read(const char *buf, struct gps_data_t *gpsdata,
*/
/*@-usedef@*/
/*@-type@*//* splint is confused about struct timespec */
- gpsdata->timedrift.real.tv_sec = (time_t)real_sec;
- gpsdata->timedrift.real.tv_nsec = (long)real_nsec;
- gpsdata->timedrift.clock.tv_sec = (time_t)clock_sec;
- gpsdata->timedrift.clock.tv_nsec = (long)clock_nsec;
+ gpsdata->pps.real.tv_sec = (time_t)real_sec;
+ gpsdata->pps.real.tv_nsec = (long)real_nsec;
+ gpsdata->pps.clock.tv_sec = (time_t)clock_sec;
+ gpsdata->pps.clock.tv_nsec = (long)clock_nsec;
/*@+type@*/
/*@+usedef@*/
if (status != 0)
@@ -521,7 +521,7 @@ int libgps_json_unpack(const char *buf,
status = json_pps_read(buf, gpsdata, end);
if (status == 0) {
gpsdata->set &= ~UNION_SET;
- gpsdata->set |= PPSDRIFT_SET;
+ gpsdata->set |= PPS_SET;
}
return status;
} else
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 1c792191..c9f99d40 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -1648,7 +1648,7 @@ void gpsd_zero_satellites( /*@out@*/ struct gps_data_t *out)
}
#ifdef NTPSHM_ENABLE
-void ntpshm_latch(struct gps_device_t *device, struct timedrift_t /*@out@*/*td)
+void ntpshm_latch(struct gps_device_t *device, struct timedelta_t /*@out@*/*td)
/* latch the fact that we've saved a fix */
{
double fix_time, integral, fractional;
diff --git a/monitor_nmea0183.c b/monitor_nmea0183.c
index 52ff0a73..1accd7e2 100644
--- a/monitor_nmea0183.c
+++ b/monitor_nmea0183.c
@@ -180,7 +180,7 @@ static void nmea_update(void)
{
char **fields;
#ifdef PPS_ENABLE
- struct timedrift_t drift;
+ struct timedelta_t ppstimes;
#endif /* PPS_ENABLE */
assert(cookedwin != NULL);
@@ -326,10 +326,10 @@ static void nmea_update(void)
#ifdef PPS_ENABLE
/*@-compdef@*/
/*@-type -noeffect@*/ /* splint is confused about struct timespec */
- if (pps_thread_lastpps(&session, &drift) > 0) {
+ if (pps_thread_lastpps(&session, &ppstimes) > 0) {
/* NOTE: can not use double here due to precision requirements */
struct timespec timedelta;
- TS_SUB( &timedelta, &drift.clock, &drift.real);
+ TS_SUB( &timedelta, &ppstimes.clock, &ppstimes.real);
if ( 86400 < (long)labs(timedelta.tv_sec) ) {
/* more than one day off, overflow */
/* need a bigger field to show it */
diff --git a/monitor_sirf.c b/monitor_sirf.c
index bf76c955..42fbb189 100644
--- a/monitor_sirf.c
+++ b/monitor_sirf.c
@@ -283,7 +283,7 @@ static void sirf_update(void)
uint8_t dgps;
char tbuf[JSON_DATE_MAX+1];
#ifdef PPS_ENABLE
- struct timedrift_t drift;
+ struct timedelta_t ppstimes;
#endif /* PPS_ENABLE */
/* splint pacification */
@@ -390,7 +390,7 @@ static void sirf_update(void)
case 0x07: /* Response - Clock Status Data */
display(mid7win, 1, 5, "%2d", getub(buf, 7)); /* SVs */
- display(mid7win, 1, 16, "%lu", getbeu32(buf, 8)); /* Clock drift */
+ display(mid7win, 1, 16, "%lu", getbeu32(buf, 8)); /* Clock ppstimes */
display(mid7win, 1, 29, "%lu", getbeu32(buf, 12)); /* Clock Bias */
display(mid7win, 2, 11, "%lu", getbeu32(buf, 16)); /* Estimated Time */
monitor_log("CSD 0x07=");
@@ -590,10 +590,10 @@ static void sirf_update(void)
#ifdef PPS_ENABLE
/*@-compdef@*/
/*@-type -noeffect@*/ /* splint is confused about struct timespec */
- if (pps_thread_lastpps(&session, &drift) > 0) {
+ if (pps_thread_lastpps(&session, &ppstimes) > 0) {
/* NOTE: cannot use double here due to precision requirements */
struct timespec timedelta;
- TS_SUB( &timedelta, &drift.clock, &drift.real);
+ TS_SUB( &timedelta, &ppstimes.clock, &ppstimes.real);
if ( 86400 < (long)labs(timedelta.tv_sec) ) {
/* more than one day off, overflow */
/* need a bigger field to show it */
diff --git a/monitor_ubx.c b/monitor_ubx.c
index c0cfab3f..9ad21286 100644
--- a/monitor_ubx.c
+++ b/monitor_ubx.c
@@ -234,7 +234,7 @@ static void ubx_update(void)
size_t data_len;
unsigned short msgid;
#ifdef PPS_ENABLE
- struct timedrift_t drift;
+ struct timedelta_t ppstimes;
#endif /* PPS_ENABLE */
buf = session.lexer.outbuffer;
@@ -257,10 +257,10 @@ static void ubx_update(void)
#ifdef PPS_ENABLE
/*@-compdef@*/
/*@-type -noeffect@*/ /* splint is confused about struct timespec */
- if (pps_thread_lastpps(&session, &drift) > 0) {
+ if (pps_thread_lastpps(&session, &ppstimes) > 0) {
/* NOTE: can not use double here due to precision requirements */
struct timespec timedelta;
- TS_SUB( &timedelta, &drift.clock, &drift.real);
+ TS_SUB( &timedelta, &ppstimes.clock, &ppstimes.real);
if ( 86400 < (long)labs(timedelta.tv_sec) ) {
/* more than one day off, overflow */
/* need a bigger field to show it */
diff --git a/ntpshm.c b/ntpshm.c
index a52918c4..39e2f003 100644
--- a/ntpshm.c
+++ b/ntpshm.c
@@ -254,7 +254,7 @@ void ntpshm_session_init(struct gps_device_t *session)
/*@+mustfreeonly@*/
}
-int ntpshm_put(struct gps_device_t *session, volatile struct shmTime *shmseg, struct timedrift_t *td)
+int ntpshm_put(struct gps_device_t *session, volatile struct shmTime *shmseg, struct timedelta_t *td)
/* put a received fix time into shared memory for NTP */
{
char real_str[TIMESPEC_LEN];
@@ -378,7 +378,7 @@ static void init_hook(struct gps_device_t *session)
/* td is the real time and clock time of the edge */
/* offset is actual_ts - clock_ts */
-static void chrony_send(struct gps_device_t *session, struct timedrift_t *td)
+static void chrony_send(struct gps_device_t *session, struct timedelta_t *td)
{
char real_str[TIMESPEC_LEN];
char clock_str[TIMESPEC_LEN];
@@ -416,7 +416,7 @@ static void wrap_hook(struct gps_device_t *session)
}
static /*@observer@*/ char *report_hook(struct gps_device_t *session,
- struct timedrift_t *td)
+ struct timedelta_t *td)
/* ship the time of a PPS event to ntpd and/or chrony */
{
char *log1;
diff --git a/ppsthread.c b/ppsthread.c
index 732c73f3..62fcb67d 100644
--- a/ppsthread.c
+++ b/ppsthread.c
@@ -629,8 +629,8 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
/* delay after last fix */
double delay;
char *log1 = NULL;
- /* drift.real is the time we think the pulse represents */
- struct timedrift_t drift;
+ /* ppstimes.real is the time we think the pulse represents */
+ struct timedelta_t ppstimes;
gpsd_report(&session->context->errout, LOG_RAW,
"PPS edge accepted %.100s", log);
#ifndef S_SPLINT_S
@@ -662,17 +662,17 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
*/
/*@+relaxtypes@*/
- drift.real.tv_sec = (time_t)trunc(last_fixtime_real) + 1;
- drift.real.tv_nsec = 0; /* need to be fixed for 5Hz */
- drift.clock = clock_ts;
+ ppstimes.real.tv_sec = (time_t)trunc(last_fixtime_real) + 1;
+ ppstimes.real.tv_nsec = 0; /* need to be fixed for 5Hz */
+ ppstimes.clock = clock_ts;
/*@-relaxtypes@*/
/* check to see if we have a fresh timestamp from the
* GPS serial input then use that */
- offset = (drift.real.tv_sec - drift.clock.tv_sec);
- offset += ((drift.real.tv_nsec - drift.clock.tv_nsec) / 1e9);
- delay = (drift.clock.tv_sec - last_fixtime_clock.tv_sec);
- delay += ((drift.clock.tv_nsec - last_fixtime_clock.tv_nsec) / 1e9);
+ offset = (ppstimes.real.tv_sec - ppstimes.clock.tv_sec);
+ offset += ((ppstimes.real.tv_nsec - ppstimes.clock.tv_nsec) / 1e9);
+ delay = (ppstimes.clock.tv_sec - last_fixtime_clock.tv_sec);
+ delay += ((ppstimes.clock.tv_nsec - last_fixtime_clock.tv_nsec) / 1e9);
if (0.0 > delay || 1.0 < delay) {
gpsd_report(&session->context->errout, LOG_RAW,
"PPS: no current GPS seconds: %f\n",
@@ -682,11 +682,11 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
/*@-compdef@*/
last_second_used = last_fixtime_real;
if (session->thread_report_hook != NULL)
- log1 = session->thread_report_hook(session, &drift);
+ log1 = session->thread_report_hook(session, &ppstimes);
else
log1 = "no report hook";
if (session->context->pps_hook != NULL)
- session->context->pps_hook(session, &drift);
+ session->context->pps_hook(session, &ppstimes);
/*@ -unrecog (splint has no pthread declarations as yet) @*/
pthread_err = pthread_mutex_lock(&ppslast_mutex);
if ( 0 != pthread_err ) {
@@ -696,7 +696,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
}
/*@ +unrecog @*/
/*@-type@*/ /* splint is confused about struct timespec */
- session->ppslast = drift;
+ session->ppslast = ppstimes;
/*@+type@*/
session->ppscount++;
/*@ -unrecog (splint has no pthread declarations as yet) @*/
@@ -708,8 +708,8 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
}
/*@ +unrecog @*/
/*@-type@*/ /* splint is confused about struct timespec */
- timespec_str( &drift.clock, ts_str1, sizeof(ts_str1) );
- timespec_str( &drift.real, ts_str2, sizeof(ts_str2) );
+ timespec_str( &ppstimes.clock, ts_str1, sizeof(ts_str1) );
+ timespec_str( &ppstimes.real, ts_str2, sizeof(ts_str2) );
gpsd_report(&session->context->errout, LOG_INF,
"PPS hooks called with %.20s clock: %s real: %s\n",
log1, ts_str1, ts_str2);
@@ -799,8 +799,8 @@ void pps_thread_stash_fixtime(struct gps_device_t *session,
/*@ +unrecog @*/
}
-int pps_thread_lastpps(struct gps_device_t *session, struct timedrift_t *td)
-/* return the drift at the time of the last PPS - only way we pass data out */
+int pps_thread_lastpps(struct gps_device_t *session, struct timedelta_t *td)
+/* return the delta at the time of the last PPS - only way we pass data out */
{
volatile int ret;
/* pthread error return */