[OpenWrt-Devel,4/5] uloop: optimize uloop_timeout_set() implementaiton a bit.
diff mbox

Message ID 1421846488-323-4-git-send-email-yszhou4tech@gmail.com
State Accepted
Headers show

Commit Message

Yousong Zhou Jan. 21, 2015, 1:21 p.m. UTC
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 uloop.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox

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);