summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-13 17:28:18 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-13 17:28:25 +0100
commit5738e579b29b00b5f23c4762d15912a4cd391fd9 (patch)
tree97db8966135f2d42b4db788c902585eeb7f85fba
parent69707553422a23353cd2c8cfd9945e2c5fb6b9b1 (diff)
layer23: Fix build against gpsd >= 3.20
During 3.19->3.20 dev cycle, some fields were transformed from timestamp_t or double to timespec_t. See for instance gpsd.git f7c230fceb6d64483757f8c32afb98e6a2cb9413. Change-Id: Ie8ba19d030b6f46f2d8afc270a732ce8c26c438f
-rw-r--r--src/host/layer23/src/common/gps.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/host/layer23/src/common/gps.c b/src/host/layer23/src/common/gps.c
index 35ee4167..807beed4 100644
--- a/src/host/layer23/src/common/gps.c
+++ b/src/host/layer23/src/common/gps.c
@@ -82,7 +82,11 @@ int osmo_gpsd_cb(struct osmo_fd *bfd, unsigned int what)
g.valid = 0;
/* gps is offline */
+#if GPSD_API_MAJOR_VERSION >= 9 && GPSD_API_MINOR_VERSION >= 0
+ if (gdata->online.tv_sec || gdata->online.tv_nsec)
+#else
if (gdata->online)
+#endif
goto gps_not_ready;
#if GPSD_API_MAJOR_VERSION >= 5
@@ -102,7 +106,11 @@ int osmo_gpsd_cb(struct osmo_fd *bfd, unsigned int what)
/* data are valid */
if (gdata->set & LATLON_SET) {
g.valid = 1;
+#if GPSD_API_MAJOR_VERSION >= 9 && GPSD_API_MINOR_VERSION >= 0
+ g.gmt = gdata->fix.time.tv_sec;
+#else
g.gmt = gdata->fix.time;
+#endif
tm = localtime(&g.gmt);
diff = time(NULL) - g.gmt;
g.latitude = gdata->fix.latitude;