diff options
author | Gary E. Miller <gem@rellim.com> | 2016-08-15 16:53:40 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-08-15 16:53:40 -0700 |
commit | e67e4118a0cbb5b5cecc62e7440299d0b5b35a37 (patch) | |
tree | 9aa35686f7b499ae7afd75e6b8b1f25a2aedfb32 /contrib/binlog.c | |
parent | 1721d7c431aeb471dcd3e36b09c4a432eb31dc5e (diff) | |
download | gpsd-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/binlog.c')
-rw-r--r-- | contrib/binlog.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/binlog.c b/contrib/binlog.c index 8e5e8d9e..0cfd4781 100644 --- a/contrib/binlog.c +++ b/contrib/binlog.c @@ -19,6 +19,7 @@ int main(int argc, char **argv) { int speed, n, ifd, ofd; struct termios term; char buf[BUFSIZ]; + struct timespec delay; if (argc != 4){ fprintf(stderr, "usage: binlog <speed> <port> <logfile>\n"); @@ -61,7 +62,10 @@ int main(int argc, char **argv) { int l = read(ifd, buf, BUFSIZ); if (l > 0) assert(write(ofd, buf, l) > 0); - usleep(1000); + /* wait 1,000 uSec */ + delay.tv_sec = 0; + delay.tv_nsec = 1000000L; + nanosleep(&delay, NULL); bzero(buf, BUFSIZ); spinner( n++ ); } |