summaryrefslogtreecommitdiff
path: root/gpsd.h-tail
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-02-02 16:11:48 -0800
committerGary E. Miller <gem@rellim.com>2015-02-02 16:11:48 -0800
commited273157309b72fda95da43bd50a468bb23476f0 (patch)
treea9ba12ad7dd466ceda4c54edd9dff7a3cabeb480 /gpsd.h-tail
parentb87323aac6ec6a4e12e813fa2214e8a480b77d13 (diff)
downloadgpsd-ed273157309b72fda95da43bd50a468bb23476f0.tar.gz
Add TS_SUB() to subtract timespecs. Fix another double.
Diffstat (limited to 'gpsd.h-tail')
-rw-r--r--gpsd.h-tail8
1 files changed, 8 insertions, 0 deletions
diff --git a/gpsd.h-tail b/gpsd.h-tail
index e3355821..b8d9e54c 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -931,6 +931,14 @@ extern void pps_early_init(struct gps_context_t *);
TS_NORM( ts ); \
} while (0)
+/* subtract two timespec */
+#define TS_SUB(r, ts1, ts2) \
+ do { \
+ (r)->tv_sec = (ts1)->tv_sec - (ts2)->tv_sec; \
+ (r)->tv_nsec = (ts1)->tv_nsec - (ts2)->tv_nsec; \
+ TS_NORM( r ); \
+ } while (0)
+
extern void pps_thread_activate(struct gps_device_t *);
extern void pps_thread_deactivate(struct gps_device_t *);
extern int pps_thread_lastpps(struct gps_device_t *, struct timedrift_t *);