diff options
-rw-r--r-- | libgps_core.c | 1 | ||||
-rw-r--r-- | libgps_shm.c | 5 | ||||
-rw-r--r-- | libgps_sock.c | 1 |
3 files changed, 5 insertions, 2 deletions
diff --git a/libgps_core.c b/libgps_core.c index 4ed336cd..9a26124d 100644 --- a/libgps_core.c +++ b/libgps_core.c @@ -217,6 +217,7 @@ const char /*@null observer@*/ *gps_data(const struct gps_data_t *gpsdata CONDIT bool gps_waiting(const struct gps_data_t *gpsdata CONDITIONALLY_UNUSED, int timeout CONDITIONALLY_UNUSED) /* is there input waiting from the GPS? */ +/* timeout is in uSec */ { /* this is bogus, but I can't think of a better solution yet */ bool waiting = true; diff --git a/libgps_shm.c b/libgps_shm.c index 90e962c8..bc245bea 100644 --- a/libgps_shm.c +++ b/libgps_shm.c @@ -75,9 +75,10 @@ int gps_shm_open(/*@out@*/struct gps_data_t *gpsdata) bool gps_shm_waiting(const struct gps_data_t *gpsdata, int timeout) /* check to see if new data has been written */ +/* timeout is in uSec */ { volatile struct shmexport_t *shared = (struct shmexport_t *)PRIVATE(gpsdata)->shmseg; - timestamp_t basetime = timestamp(); + timestamp_t endtime = timestamp() + (((double)timeout)/1000000);; volatile bool newdata = false; /* busy-waiting sucks, but there's not really an alternative */ @@ -90,7 +91,7 @@ bool gps_shm_waiting(const struct gps_data_t *gpsdata, int timeout) memory_barrier(); if (bookend1 == bookend2 && bookend1 > PRIVATE(gpsdata)->tick) newdata = true; - if (newdata || (timestamp() - basetime >= (double)timeout)) + if (newdata || (timestamp() >= endtime)) break; } diff --git a/libgps_sock.c b/libgps_sock.c index e36e4ff1..a87cd444 100644 --- a/libgps_sock.c +++ b/libgps_sock.c @@ -100,6 +100,7 @@ int gps_sock_open(/*@null@*/const char *host, /*@null@*/const char *port, bool gps_sock_waiting(const struct gps_data_t *gpsdata, int timeout) /* is there input waiting from the GPS? */ +/* timeout is in uSec */ { #ifndef USE_QT fd_set rfds; |