summaryrefslogtreecommitdiff
path: root/gpsmon.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-08-15 16:53:40 -0700
committerGary E. Miller <gem@rellim.com>2016-08-15 16:53:40 -0700
commite67e4118a0cbb5b5cecc62e7440299d0b5b35a37 (patch)
tree9aa35686f7b499ae7afd75e6b8b1f25a2aedfb32 /gpsmon.c
parent1721d7c431aeb471dcd3e36b09c4a432eb31dc5e (diff)
downloadgpsd-e67e4118a0cbb5b5cecc62e7440299d0b5b35a37.tar.gz
usleep() is removed from POSIX-2008. Replace with nanosleep()
I sure hope I did not drop a zero anywhere...
Diffstat (limited to 'gpsmon.c')
-rw-r--r--gpsmon.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gpsmon.c b/gpsmon.c
index ee4aaeb7..f9475887 100644
--- a/gpsmon.c
+++ b/gpsmon.c
@@ -861,6 +861,7 @@ static bool do_command(const char *line)
{
#ifdef RECONFIGURE_ENABLE
unsigned int v;
+ struct timespec delay;
#endif /* RECONFIGURE_ENABLE */
#ifdef CONTROLSEND_ENABLE
unsigned char buf[BUFLEN];
@@ -963,7 +964,12 @@ static bool do_command(const char *line)
switcher->mode_switcher(&session, (int)v);
context.readonly = true;
(void)tcdrain(session.gpsdata.gps_fd);
- (void)usleep(50000);
+
+ /* wait 50,000 uSec */
+ delay.tv_sec = 0;
+ delay.tv_nsec = 50000000L;
+ nanosleep(&delay, NULL);
+
/*
* Session device change will be set to NMEA when
* gpsmon resyncs. So stash the current type to
@@ -1035,7 +1041,11 @@ static bool do_command(const char *line)
* buffer.
*/
(void)tcdrain(session.gpsdata.gps_fd);
- (void)usleep(50000);
+ /* wait 50,000 uSec */
+ delay.tv_sec = 0;
+ delay.tv_nsec = 50000000L;
+ nanosleep(&delay, NULL);
+
(void)gpsd_set_speed(&session, speed,
parity, stopbits);
} else