summaryrefslogtreecommitdiff
path: root/gpsd.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 /gpsd.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 'gpsd.c')
-rw-r--r--gpsd.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gpsd.c b/gpsd.c
index eb25a654..4e4b7f0b 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -999,6 +999,7 @@ static void set_serial(struct gps_device_t *device,
unsigned int stopbits = device->gpsdata.dev.stopbits;
char parity = device->gpsdata.dev.parity;
int wordsize = 8;
+ struct timespec delay;
#ifndef __clang_analyzer__
while (isspace((unsigned char) *modestring))
@@ -1041,7 +1042,12 @@ static void set_serial(struct gps_device_t *device,
* across any given type of UART.
*/
(void)tcdrain(device->gpsdata.gps_fd);
- (void)usleep(50000);
+
+ /* wait 50,000 uSec */
+ delay.tv_sec = 0;
+ delay.tv_nsec = 50000000L;
+ nanosleep(&delay, NULL);
+
gpsd_set_speed(device, speed, parity, stopbits);
}
}