[OpenWrt-Devel] [PATCH 4/5] uloop: optimize uloop_timeout_set() implementaiton a bit.
Yousong Zhou
yszhou4tech at gmail.com
Wed Jan 21 08:21:27 EST 2015
Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
---
uloop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/uloop.c b/uloop.c
index 3224f4b..883f6f1 100644
--- a/uloop.c
+++ b/uloop.c
@@ -453,14 +453,14 @@ int uloop_timeout_set(struct uloop_timeout *timeout, int msecs)
if (timeout->pending)
uloop_timeout_cancel(timeout);
- uloop_gettime(&timeout->time);
+ uloop_gettime(time);
time->tv_sec += msecs / 1000;
time->tv_usec += (msecs % 1000) * 1000;
if (time->tv_usec > 1000000) {
time->tv_sec++;
- time->tv_usec %= 1000000;
+ time->tv_usec -= 1000000;
}
return uloop_timeout_add(timeout);
--
2.2.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list