diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-03-01 23:57:01 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-03-01 23:57:01 -0500 |
commit | 44b3532e07d2e3790a75ccd5a75f19deefa71e82 (patch) | |
tree | 3d1bd2eaf9a5134dbcee9247e5f31343c7e96fde /ntpshmread.c | |
parent | 4964c68cf4ebca29d745ba02c4ba3da4a68e9abd (diff) | |
download | gpsd-44b3532e07d2e3790a75ccd5a75f19deefa71e82.tar.gz |
Implement POSIX clock_gettime(3) for systems that lack it (like Mac OS X).
On Mac OS X it will get proper nanosecond precision; elsewhere, only
microseconds. Hides the conformance failure from the rest of the code.
All regression tests pass.
Diffstat (limited to 'ntpshmread.c')
-rw-r--r-- | ntpshmread.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/ntpshmread.c b/ntpshmread.c index 092e6e95..7a9206e3 100644 --- a/ntpshmread.c +++ b/ntpshmread.c @@ -74,16 +74,7 @@ enum segstat_t shm_query(/*@null@*/struct shmTime *shm_in, /*@out@*/struct shm_s /*@-type@*//* splint is confused about struct timespec */ shm_stat->tvc.tv_sec = shm_stat->tvc.tv_nsec = 0; -#ifdef HAVE_CLOCK_GETTIME clock_gettime(CLOCK_REALTIME, &shm_stat->tvc); -#else - { - struct timeval tv; - (void)gettimeofday(&tv, NULL); - shm_stat->tvc.tv_sec = tv.tv_sec; - shm_stat->tvc.tv_nsec = tv.tv_usec * 1000; - } -#endif /* relying on word access to be atomic here */ if (shm->valid == 0) { |