diff mbox

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

Message ID 1452088700-26221-3-git-send-email-ivan.khoronzhuk@linaro.org
State New
Headers show

Commit Message

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

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

Patch

diff --git a/test/validation/time/time.c b/test/validation/time/time.c
index 5761540..9a3392d 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -40,7 +40,9 @@  static int 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++;
+
 	return res;
 }