summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <[email protected]>2016-05-24 22:00:37 +0200
committerdimitri staessens <[email protected]>2016-05-24 22:04:20 +0200
commit6810422ff51834779b384dc0b0c56871b35b1392 (patch)
treebd28ff75999e43892342c0bf97910dd292501052
parente5f567c7647acefa295850f5ab6ccf2c10329c44 (diff)
downloadouroboros-6810422ff51834779b384dc0b0c56871b35b1392.tar.gz
ouroboros-6810422ff51834779b384dc0b0c56871b35b1392.zip
lib: fixed time difference for timevals
the structure is tv->tv_usec, not tv->tv_nsec
-rw-r--r--include/ouroboros/time_utils.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/ouroboros/time_utils.h b/include/ouroboros/time_utils.h
index 4b3f3463..320cb6f1 100644
--- a/include/ouroboros/time_utils.h
+++ b/include/ouroboros/time_utils.h
@@ -46,8 +46,10 @@
+ ((tx)->tv_nsec - (t0)->tv_nsec) / MILLION)
/* functions for timevals are the same */
-#define tv_diff_us(t0, tx) ts_diff_us(t0, tx)
-#define tv_diff_ms(t0, tx) ts_diff_ms(t0, tx)
+#define tv_diff_us(t0, tx) (((tx)->tv_sec - (t0)->tv_sec) * MILLION \
+ + ((tx)->tv_usec - (t0)->tv_usec) / 1000L)
+#define tv_diff_ms(t0, tx) (((tx)->tv_sec - (t0)->tv_sec) * 1000L \
+ + ((tx)->tv_usec - (t0)->tv_usec) / MILLION)
/* functions for timespecs */
int ts_add(const struct timespec * t,