summaryrefslogtreecommitdiff
path: root/libgps_sock.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-12-26 16:44:12 -0800
committerGary E. Miller <gem@rellim.com>2018-12-26 16:44:12 -0800
commit73620da884724a9266c7437a7814fa4faeffbabd (patch)
tree6ddd73a5a2bd919a17baa19a1710236c04c9fa9e /libgps_sock.c
parent5517175ed53b877720fdf5a1a4085386b40c4590 (diff)
downloadgpsd-73620da884724a9266c7437a7814fa4faeffbabd.tar.gz
libgps_sock: Fix pselect() buglet.
Diffstat (limited to 'libgps_sock.c')
-rw-r--r--libgps_sock.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libgps_sock.c b/libgps_sock.c
index 923703c7..eea8a04d 100644
--- a/libgps_sock.c
+++ b/libgps_sock.c
@@ -17,6 +17,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include "gpsd_config.h"
+#include "timespec.h" /* for NS_IN_SEC */
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif /* HAVE_SYS_SELECT_H */
@@ -143,8 +144,8 @@ bool gps_sock_waiting(const struct gps_data_t *gpsdata, int timeout)
FD_ZERO(&rfds);
FD_SET(gpsdata->gps_fd, &rfds);
- tv.tv_sec = timeout / 1000000;
- tv.tv_nsec = timeout % 1000000000;
+ tv.tv_sec = timeout / NS_IN_SEC;
+ tv.tv_nsec = timeout % NS_IN_SEC;
/* all error conditions return "not waiting" -- crude but effective */
return (pselect(gpsdata->gps_fd + 1, &rfds, NULL, NULL, &tv, NULL) == 1);
#else