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 /gpsutils.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 'gpsutils.c')
-rw-r--r-- | gpsutils.c | 6 |
1 files changed, 0 insertions, 6 deletions
@@ -299,15 +299,9 @@ void gps_merge_fix( /*@ out @*/ struct gps_fix_t *to, * near microSec. Do not use near PPS which is nanoSec precise */ timestamp_t timestamp(void) { -#ifdef HAVE_CLOCK_GETTIME struct timespec ts; /*@i2@*/(void)clock_gettime(CLOCK_REALTIME, &ts); /*@i3@*/return (timestamp_t)(ts.tv_sec + ts.tv_nsec * 1e-9); -#else - struct timeval tv; - (void)gettimeofday(&tv, NULL); - return (timestamp_t)(tv.tv_sec + tv.tv_usec * 1e-6); -#endif } time_t mkgmtime(register struct tm * t) |