From patchwork Mon Jan 11 09:58:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 59449 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2006186lbb; Mon, 11 Jan 2016 01:59:57 -0800 (PST) X-Received: by 10.55.209.213 with SMTP id o82mr281484qkl.13.1452506397292; Mon, 11 Jan 2016 01:59:57 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a64si88628471qha.39.2016.01.11.01.59.56; Mon, 11 Jan 2016 01:59:57 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id BB25A616C5; Mon, 11 Jan 2016 09:59:56 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=TG5M68rU; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id E4EC3616D2; Mon, 11 Jan 2016 09:59:03 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 87F51616C5; Mon, 11 Jan 2016 09:58:58 +0000 (UTC) Received: from mail-lf0-f53.google.com (mail-lf0-f53.google.com [209.85.215.53]) by lists.linaro.org (Postfix) with ESMTPS id A1B83616B5 for ; Mon, 11 Jan 2016 09:58:56 +0000 (UTC) Received: by mail-lf0-f53.google.com with SMTP id m198so62568598lfm.0 for ; Mon, 11 Jan 2016 01:58:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=vpl+LKrRZ/BYl0WIesuNKHYzBE/VP242F8SZTNUoeNs=; b=TG5M68rU/C17qUx0zm7Ye8lU/oeTFoPIzFEZ4g+NPA0ZGC76qM17H4mgYIbvaunTSM 4ovDuKh9UwFkLjIoz3OXmT3diY1EeNLh0a5m20JjRFImB0BZnifvGltV486EndFd1Jms ISdSz1L+rxsucMAba5MVwucEiEvLgYC1K548g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vpl+LKrRZ/BYl0WIesuNKHYzBE/VP242F8SZTNUoeNs=; b=S/Seb1IH2PisO9wsbPXwWStVfaHH9ukwjXog9EbrM06YSIpPvSGVh2MmxGtwQ2eRaW saWRHOTPonSGlXUv7tNvh7TeaBFtCGe35uuPy0DvIbDt+vG+QXpIyFyEASVG5fxJFGnG j8mS5gkMpShW4FkW5mCKhVBnO9Of00P+X/lJDnzrBHYXB2lDP0K5XlaBGxPilUVgP7Jf 3k8NcNDRzoEafD5YVqKeP6t1K8HsfhT0lvqU1w1C0rUAQ0C3VjzKcMEazXxWbVHZb+ur CmJHiDcx0lCVdzm/MElH6FUX4YfXlCY7j+t9bGnPMgF9xNU8NgUVm42+G/i/f035ja5p npCw== X-Gm-Message-State: ALoCoQkPmGit2f2fAXQ02ynFQ1cQH98ipOkzj0+lO37pCfY/hD89xGuQTqmMt2A06URMuel0BkWynMacebf5ZHQZhw5iJBsXqQ== X-Received: by 10.25.22.38 with SMTP id m38mr3300304lfi.142.1452506335599; Mon, 11 Jan 2016 01:58:55 -0800 (PST) Received: from localhost.localdomain ([212.90.63.58]) by smtp.gmail.com with ESMTPSA id 87sm15384153lfr.44.2016.01.11.01.58.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 11 Jan 2016 01:58:54 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Mon, 11 Jan 2016 11:58:44 +0200 Message-Id: <1452506325-12479-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452506325-12479-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1452506325-12479-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 2/3] validation: time: round up resolution X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" While division the resolution can have fractional part, so better to round it up, when it's needed. Reviewed-by: Bill Fischofer Signed-off-by: Ivan Khoronzhuk --- test/validation/time/time.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/validation/time/time.c b/test/validation/time/time.c index b4e53ec..d0d198a 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -40,7 +40,8 @@ static void time_test_res(time_res_cb time_res, uint64_t *res) CU_ASSERT(rate < MAX_TIME_RATE); *res = ODP_TIME_SEC_IN_NS / rate; - *res = *res ? *res : 1; + if (ODP_TIME_SEC_IN_NS % rate) + (*res)++; } void time_test_local_res(void)