From 08c27ceb016ae42235c413a7693f18f437cd4972 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Wed, 21 Jan 2015 21:21:27 +0800 Subject: [PATCH] uloop: optimize uloop_timeout_set() implementaiton a bit. Signed-off-by: Yousong Zhou --- uloop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uloop.c b/uloop.c index 9a77ce4..d4df6e2 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.25.1