summaryrefslogtreecommitdiff
path: root/timespec.h
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-12-26 17:46:10 -0800
committerGary E. Miller <gem@rellim.com>2018-12-26 17:46:10 -0800
commit931995286ff337b6357b5d96cb864f8e39179d24 (patch)
treeb2b8791edadcdf4542e3c81f5aadaf613db0ef95 /timespec.h
parent959c6722c5d043394c0795b35c7dd54d8cd26476 (diff)
downloadgpsd-931995286ff337b6357b5d96cb864f8e39179d24.tar.gz
timespec.h: Change MS to US for micro seconds.
Diffstat (limited to 'timespec.h')
-rw-r--r--timespec.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/timespec.h b/timespec.h
index df178b36..8d36a9ec 100644
--- a/timespec.h
+++ b/timespec.h
@@ -18,9 +18,9 @@
*
* NOTE: this normalization is not the same as ntpd uses
*/
-#define NS_IN_SEC 1000000000LL
+#define NS_IN_SEC 1000000000LL /* nanoseconds in a second */
#define US_IN_SEC 1000000LL /* microseconds in a second */
-#define MS_IN_SEC 1000000LL
+#define MS_IN_SEC 1000LL /* milliseconds in a second */
/* return the difference between timespecs in nanoseconds
* int may be too small, 32 bit long is too small, floats are too imprecise,
@@ -60,11 +60,11 @@ static inline void TS_NORM( struct timespec *ts)
/* normalize a timeval */
#define TV_NORM(tv) \
do { \
- if ( MS_IN_SEC <= (tv)->tv_usec ) { \
- (tv)->tv_usec -= MS_IN_SEC; \
+ if ( US_IN_SEC <= (tv)->tv_usec ) { \
+ (tv)->tv_usec -= US_IN_SEC; \
(tv)->tv_sec++; \
} else if ( 0 > (tv)->tv_usec ) { \
- (tv)->tv_usec += MS_IN_SEC; \
+ (tv)->tv_usec += US_IN_SEC; \
(tv)->tv_sec--; \
} \
} while (0)