summaryrefslogtreecommitdiff
path: root/ppsthread.h
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-08 09:53:31 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-08 09:53:31 -0400
commitc492d91075cbb10c13b2670a8d63e0dae1014ec4 (patch)
tree55412f862680b4699282879891a8fbe77342666a /ppsthread.h
parentc82fe00247bd9fcbf5a70901c3b022e8ddd5ab0f (diff)
downloadgpsd-c492d91075cbb10c13b2670a8d63e0dae1014ec4.tar.gz
Hide a macro that doesn't need to be exposed.
Diffstat (limited to 'ppsthread.h')
-rw-r--r--ppsthread.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/ppsthread.h b/ppsthread.h
index 73c8720b..4178813b 100644
--- a/ppsthread.h
+++ b/ppsthread.h
@@ -22,6 +22,20 @@
#endif
#endif /* S_SPLINT_S */
+#ifndef TIMEDELTA_DEFINED
+#define TIMEDELTA_DEFINED
+struct timedelta_t {
+ struct timespec real;
+ struct timespec clock;
+};
+#endif /* TIMEDELTA_DEFINED */
+
+
+/* difference between timespecs in nanoseconds */
+/* int is too small, avoid floats */
+/* WARNING! this will overflow if x and y differ by more than a few seconds */
+#define timespec_diff_ns(x, y) (long)(((x).tv_sec-(y).tv_sec)*1000000000+(x).tv_nsec-(y).tv_nsec)
+
struct pps_thread_t {
struct timespec fixin_real; /* in-band time of the fix */
struct timespec fixin_clock; /* system clock time when fix received */