summaryrefslogtreecommitdiff
path: root/gpsutils.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-01 23:57:01 -0500
committerEric S. Raymond <esr@thyrsus.com>2015-03-01 23:57:01 -0500
commit44b3532e07d2e3790a75ccd5a75f19deefa71e82 (patch)
tree3d1bd2eaf9a5134dbcee9247e5f31343c7e96fde /gpsutils.c
parent4964c68cf4ebca29d745ba02c4ba3da4a68e9abd (diff)
downloadgpsd-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.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/gpsutils.c b/gpsutils.c
index fa15bc49..e7000f70 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -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)