From patchwork Wed Jan 21 13:21:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yousong Zhou X-Patchwork-Id: 431472 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6BB6614029E for ; Thu, 22 Jan 2015 00:23:44 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id A7C9928BDBF; Wed, 21 Jan 2015 14:20:10 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 4E06528BDAC for ; Wed, 21 Jan 2015 14:19:54 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 CL_IP_EQ_HELO_IP=-2 (check from: .gmail. - helo: .mail-pd0-f181.google. - helo-domain: .google.) FROM/MX_MATCHES_HELO(DOMAIN)=-2; rate: -8.5 Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 21 Jan 2015 14:19:50 +0100 (CET) Received: by mail-pd0-f181.google.com with SMTP id g10so16718619pdj.12 for ; Wed, 21 Jan 2015 05:22:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Mjiqmo6vKM5x+WQGRY/KH+7ln5vSUCupN73rk2c7ZEg=; b=UuTBzbDUudlev4/uRaY8mBUHO25Ufq9crQO8ZI8xNYGyt+sbkx4KfvxwJFTYJbesIb MF+BoHroNewe7JbtOUqUMKhd57JG/ISx1gIsOyH+WaN+sPqOJiX7wLbl36d1ZESvrrt1 VBJR8dWRfGYwyumWgEb+bpSs6dhSj7vRaI/f0XPD46/oWylp87VgB+wqPBed+0NBD42T IFuP7bJhSbiqQtJxDAWzZnFlaD8oHM0HVu4f8C8vOv2M8r6vL3X4cnYKX+qv9WsHVTJp 5jybmQCBr3zv9CfFSMKJNemU8doEcp2E3OjaPfMmtsJD6jndUb4iPhz+j0/5H3oCpIC1 TWuA== X-Received: by 10.70.135.137 with SMTP id ps9mr62609482pdb.135.1421846527822; Wed, 21 Jan 2015 05:22:07 -0800 (PST) Received: from yousongs-MacBook-Air.local.info ([103.29.140.56]) by mx.google.com with ESMTPSA id kv4sm6314878pab.22.2015.01.21.05.22.04 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 21 Jan 2015 05:22:06 -0800 (PST) From: Yousong Zhou To: nbd@openwrt.org Date: Wed, 21 Jan 2015 21:21:27 +0800 Message-Id: <1421846488-323-4-git-send-email-yszhou4tech@gmail.com> X-Mailer: git-send-email 2.2.1 In-Reply-To: <1421846488-323-1-git-send-email-yszhou4tech@gmail.com> References: <1421846488-323-1-git-send-email-yszhou4tech@gmail.com> Cc: openwrt-devel@lists.openwrt.org Subject: [OpenWrt-Devel] [PATCH 4/5] uloop: optimize uloop_timeout_set() implementaiton a bit. X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Signed-off-by: Yousong Zhou --- 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);