From patchwork Fri Jan 8 18:44:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 59383 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp726936lbb; Fri, 8 Jan 2016 10:45:54 -0800 (PST) X-Received: by 10.140.29.131 with SMTP id b3mr144450617qgb.50.1452278754509; Fri, 08 Jan 2016 10:45:54 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id z49si109445263qge.115.2016.01.08.10.45.54; Fri, 08 Jan 2016 10:45:54 -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 DA60561779; Fri, 8 Jan 2016 18:45:53 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=jQe0CAOG; 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 D3C42616ED; Fri, 8 Jan 2016 18:45:22 +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 C57BC616B9; Fri, 8 Jan 2016 18:45:19 +0000 (UTC) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com [209.85.217.177]) by lists.linaro.org (Postfix) with ESMTPS id 00749616E9 for ; Fri, 8 Jan 2016 18:44:57 +0000 (UTC) Received: by mail-lb0-f177.google.com with SMTP id cl12so11960987lbc.1 for ; Fri, 08 Jan 2016 10:44: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=aoFDwlgcbNgTFTcDkCKjxYgWUTD3c9rTOnFugG6mwMs=; b=jQe0CAOGFEn1RJ5k4iBlIaBmTYaOOqYmT/hFwmj6FMmZaHSzmCIeM8YmX1ZcCBg5Gs FI77AGeRYUJ10LCSLoHNT/6DLkfm3QvWeQbPNljjX8efFQoNONZ0ZBSw4EWo8FChImhO m3ACXQCLTlqX8PZ1IwoIgWGKm7eXnT/JIHBiM= 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=aoFDwlgcbNgTFTcDkCKjxYgWUTD3c9rTOnFugG6mwMs=; b=Uf5PPuNWc38eh76BzSCw58KGBGLLE0JNWvg0D+nMlGz4DfR+yuEGAdsb6YM2MRT57C wnrC2qyF0/VFxVJLfVsEVfVVzFaAfE/GkvnfC76LWUx9XvcAClmbYLW1hvm7iJXDgQr5 MV1indZyj+LRl1kunBrUd3FI34N9k5u4TADIMEZ00rCe8uhAFjOm9H7ycx5EmNtlEJAr mFNxBpHMcxpMGG+AvyBZd5weIWDdGGXEKzExzxSARnjBODdTYBe8tRcYQ6IlSkyrN1JT p5Me9s5tCSV4CxntpcigsVkdSwsqbTt2RZW05jwJR8uNZr71oLm9lZ8LptcjHKdTm6AT kDBQ== X-Gm-Message-State: ALoCoQlX4FxUn++qhFxCd76WTpIKb+Lvlf+JnKQiu/7bGNBKnDlnykc7QB7RgigAt/4WeqCW6Tc68Kvc3YN0XzYeov3YVBlPPg== X-Received: by 10.112.219.101 with SMTP id pn5mr12595212lbc.123.1452278695969; Fri, 08 Jan 2016 10:44:55 -0800 (PST) Received: from localhost.localdomain ([212.90.63.58]) by smtp.gmail.com with ESMTPSA id 99sm14938489lfp.30.2016.01.08.10.44.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 08 Jan 2016 10:44:54 -0800 (PST) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Fri, 8 Jan 2016 20:44:47 +0200 Message-Id: <1452278688-30483-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1452278688-30483-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1452278688-30483-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/validation/time/time.c b/test/validation/time/time.c index a4388fc..d0d198a 100644 --- a/test/validation/time/time.c +++ b/test/validation/time/time.c @@ -40,8 +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; - return res; + if (ODP_TIME_SEC_IN_NS % rate) + (*res)++; } void time_test_local_res(void)