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 /ntpshmmon.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 'ntpshmmon.c')
-rw-r--r-- | ntpshmmon.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ntpshmmon.c b/ntpshmmon.c index 8706f414..aa89806b 100644 --- a/ntpshmmon.c +++ b/ntpshmmon.c @@ -98,6 +98,7 @@ int main(int argc, char **argv) do { /* the current segment */ struct shm_stat_t shm_stat; + struct timespec delay; for (i = 0; i < NTPSEGMENTS; i++) { long long diff; /* 32 bit long is too short for a timespec */ @@ -164,7 +165,7 @@ int main(int argc, char **argv) * That is a 200 millSec cycle, minimum 20 milliSec duration * we will wait 1 milliSec out of caution * - * and, of course, usleep() may sleep a lot longer than we ask... + * and, of course, nanosleep() may sleep a lot longer than we ask... */ if ( timeout ) { /* do not read time unless it matters */ @@ -173,7 +174,11 @@ int main(int argc, char **argv) break; } } - (void)usleep((useconds_t)1000); + + /* wait 1,000 uSec */ + delay.tv_sec = 0; + delay.tv_nsec = 1000000L; + nanosleep(&delay, NULL); } while ( 0 < nsamples ); exit(EXIT_SUCCESS); |