diff mbox

[v3,2/3] validation: time: round up resolution

Message ID 1452506325-12479-3-git-send-email-ivan.khoronzhuk@linaro.org
State Accepted
Commit a9a7179fdee2b629ac89bd97684fdbb62261ab7c
Headers show

Commit Message

Ivan Khoronzhuk Jan. 11, 2016, 9:58 a.m. UTC
While division the resolution can have fractional part, so better to
round it up, when it's needed.

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/validation/time/time.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

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)