summaryrefslogtreecommitdiff
path: root/gps.h
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-02-02 15:46:55 -0800
committerGary E. Miller <gem@rellim.com>2015-02-02 15:46:55 -0800
commitb87323aac6ec6a4e12e813fa2214e8a480b77d13 (patch)
treee649b192c3b535e1757aa0ee6328deab1a588b3f /gps.h
parentb73abff012abacf770a9f59fb054b721e2b9e336 (diff)
downloadgpsd-b87323aac6ec6a4e12e813fa2214e8a480b77d13.tar.gz
Comment possible numeric overflow in timespec_diff_ns()
timespec_diff_ns() should not be used is the delta is more than about 2 seconds.
Diffstat (limited to 'gps.h')
-rw-r--r--gps.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gps.h b/gps.h
index 6bf7c336..20a5f5e8 100644
--- a/gps.h
+++ b/gps.h
@@ -1891,6 +1891,7 @@ struct timedrift_t {
/* 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)
/*