summaryrefslogtreecommitdiff
path: root/serial.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 /serial.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 'serial.c')
-rw-r--r--serial.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/serial.c b/serial.c
index b29178ec..73952fd1 100644
--- a/serial.c
+++ b/serial.c
@@ -255,6 +255,7 @@ void gpsd_set_speed(struct gps_device_t *session,
speed_t speed, char parity, unsigned int stopbits)
{
speed_t rate;
+ struct timespec delay;
/*
* Yes, you can set speeds that aren't in the hunt loop. If you
@@ -380,7 +381,11 @@ void gpsd_set_speed(struct gps_device_t *session,
* occasional failure to lock.
*/
(void)tcflush(session->gpsdata.gps_fd, TCIOFLUSH);
- (void)usleep(200000);
+
+ /* wait 200,000 uSec */
+ delay.tv_sec = 0;
+ delay.tv_nsec = 200000000L;
+ nanosleep(&delay, NULL);
(void)tcflush(session->gpsdata.gps_fd, TCIOFLUSH);
}
gpsd_log(&session->context->errout, LOG_INF,