summaryrefslogtreecommitdiff
path: root/timespec.h
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-06-04 20:34:12 -0700
committerGary E. Miller <gem@rellim.com>2015-06-04 20:34:12 -0700
commit70b0355e571f06d9b2c241c52328d58c4b0abceb (patch)
tree7c48190be653cfb1a0ba17952c55166b4e10f446 /timespec.h
parentbcd00a93bbf7bd987930d7968cce4eeb6215e9a5 (diff)
downloadgpsd-70b0355e571f06d9b2c241c52328d58c4b0abceb.tar.gz
Add warning for TSTONS()
Doubles are just not big enough...
Diffstat (limited to 'timespec.h')
-rw-r--r--timespec.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/timespec.h b/timespec.h
index d45856ee..d1ee3d3d 100644
--- a/timespec.h
+++ b/timespec.h
@@ -93,8 +93,9 @@ static inline void TS_NORM( struct timespec *ts)
} while (0)
/* convert a timespec to a double.
- * is tv_sec > 2, then inevitable loss of precision in tv_nsec */
-#define TSTONS(ts) ((double)((ts)->tv_sec + ((ts)->tv_nsec / 1e9)))
+ * if tv_sec > 2, then inevitable loss of precision in tv_nsec
+ 8 so best to NEVER use TSTONS() */
+#define TSTONS(ts) ((double)((ts)->tv_sec + ((ts)->tv_nsec / NS_IN_SEC)))
#define TIMESPEC_LEN 22 /* required length of a timespec buffer */