summaryrefslogtreecommitdiff
path: root/contrib/ashctl.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 /contrib/ashctl.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 'contrib/ashctl.c')
-rw-r--r--contrib/ashctl.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/contrib/ashctl.c b/contrib/ashctl.c
index fdf04bfd..f1cfdcf4 100644
--- a/contrib/ashctl.c
+++ b/contrib/ashctl.c
@@ -157,6 +157,7 @@ static int nmea_send(int fd, const char *fmt, ... )
size_t status;
char buf[BUFSIZ];
va_list ap;
+ struct timespec delay;
va_start(ap, fmt) ;
(void)vsnprintf(buf, sizeof(buf)-5, fmt, ap);
@@ -167,7 +168,11 @@ static int nmea_send(int fd, const char *fmt, ... )
tcflush(fd, TCIOFLUSH);
status = (size_t)write(fd, buf, strlen(buf));
tcdrain(fd);
- usleep(100000);
+ /* wait 100,000 uSec */
+ delay.tv_sec = 0;
+ delay.tv_nsec = 100000000L;
+ nanosleep(&delay, NULL);
+
if (status == strlen(buf)) {
return (int)status;
} else {