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/binreplay.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/binreplay.c')
-rw-r--r-- | contrib/binreplay.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/contrib/binreplay.c b/contrib/binreplay.c index 36389e09..8b68bc1d 100644 --- a/contrib/binreplay.c +++ b/contrib/binreplay.c @@ -31,6 +31,7 @@ int main( int argc, char **argv){ char *buf, tn[32]; int ifd, ofd, sfd; int dflag = 0, c, sleeptime, len, speed = 0; + struct timespec delay; while((c = getopt(argc, argv, "d:r:s:")) != -1) { switch(c){ @@ -117,7 +118,10 @@ int main( int argc, char **argv){ tcflush(sfd, TCIFLUSH); } spinner( len ); - usleep(sleeptime); + /* wait sleeptime Sec */ + delay.tv_sec = (time_t)(sleeptime / 1000000000L); + delay.tv_nsec = sleeptime % 1000000000L; + nanosleep(&delay, NULL); } munmap(buf, sb.st_size); |