summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2015-06-05 11:05:03 -0700
committerGary E. Miller <gem@rellim.com>2015-06-05 11:05:03 -0700
commit09f2659e61a0b73c05841dfe3c4da5d3311e0c92 (patch)
treed8a387a3470c5f5435c4110589b13905a9b596ea
parent8c8de4309249ed5a8af1115541ad375b74ebcd7a (diff)
downloadgpsd-09f2659e61a0b73c05841dfe3c4da5d3311e0c92.tar.gz
Fix some nits.
-rw-r--r--test_timespec.c4
-rw-r--r--timespec.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/test_timespec.c b/test_timespec.c
index d54f4303..11834e61 100644
--- a/test_timespec.c
+++ b/test_timespec.c
@@ -312,7 +312,7 @@ static int ex_subtract_float( void )
printf("ts: %21s - %21s = %21s\n", buf_a, buf_b, buf_r);
printf("l; %21s - %21s = %21lld\n", buf_a, buf_b, l);
printf("l32; %21s - %21s = %21lld\n", buf_a, buf_b, (long long)l32);
- printf("l64; %21s - %21s = %21lld\n", buf_a, buf_b, l64);
+ printf("l64; %21s - %21s = %21lld\n", buf_a, buf_b, (long long)l64);
printf("f; %21.9f - %21.9f = %21.9f\n", f_a, f_b, f_r);
printf("d; %21.9f - %21.9f = %21.9f\n", d_a, d_b, d_r);
puts("\n");
@@ -353,8 +353,8 @@ static void ex_precision(void)
l32 = (int32_t)(v->tv_sec * NS_IN_SEC)+(int32_t)v->tv_nsec;
l64 = (int64_t)(v->tv_sec * NS_IN_SEC)+(int64_t)v->tv_nsec;
+ f = (float)TSTONS( v );
d = TSTONS( v );
- f = (float) d;
timespec_str( v, buf, sizeof(buf) );
printf( "ts: %21s\n"
"l32: %21lld\n"
diff --git a/timespec.h b/timespec.h
index 5fd7fe1e..f7c7d748 100644
--- a/timespec.h
+++ b/timespec.h
@@ -95,7 +95,7 @@ static inline void TS_NORM( struct timespec *ts)
/* convert a timespec to a double.
* if tv_sec > 2, then inevitable loss of precision in tv_nsec
* so best to NEVER use TSTONS()
- * WARNING replacing 1e9 with NS_TO_SEC casues loss of precision */
+ * WARNING replacing 1e9 with NS_IN_SEC casues loss of precision */
#define TSTONS(ts) ((double)((ts)->tv_sec + ((ts)->tv_nsec / 1e9)))
#define TIMESPEC_LEN 22 /* required length of a timespec buffer */