diff options
author | Felix Fietkau <nbd@openwrt.org> | 2012-10-31 23:28:11 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2012-10-31 23:28:15 +0400 |
commit | 407f7a0bb3272ee03f2eb05391ce8b94238fa92e (patch) | |
tree | c5e93fcc2d1ae0393674328abbe49a701f4093a5 | |
parent | 0385cbc068b04940b8f2e2b6b1d47d10437139e0 (diff) |
uloop: fix tv_diff() calculation
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
-rw-r--r-- | uloop.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -304,10 +304,9 @@ out: static int tv_diff(struct timeval *t1, struct timeval *t2) { - if (t1->tv_sec != t2->tv_sec) - return (t1->tv_sec - t2->tv_sec) * 1000; - else - return (t1->tv_usec - t2->tv_usec) / 1000; + return + (t1->tv_sec - t2->tv_sec) * 1000 + + (t1->tv_usec - t2->tv_usec) / 1000; } int uloop_timeout_add(struct uloop_timeout *timeout) |