diff mbox

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

Message ID 1452278688-30483-3-git-send-email-ivan.khoronzhuk@linaro.org
State Superseded
Headers show

Commit Message

Ivan Khoronzhuk Jan. 8, 2016, 6:44 p.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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

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)