From e67e4118a0cbb5b5cecc62e7440299d0b5b35a37 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" Date: Mon, 15 Aug 2016 16:53:40 -0700 Subject: usleep() is removed from POSIX-2008. Replace with nanosleep() I sure hope I did not drop a zero anywhere... --- gpsmon.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gpsmon.c') 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 -- cgit v1.2.1