From e9ab4a6831c89f331bae2fbb6d879cc7e85c24b1 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 27 Dec 2019 20:15:26 -0800 Subject: Time calculations in acutest.h off by factor of 10. Also, the MONOTONIC_RAW clock on linux is a poor choice for accurate timing. Use the normal MONOTONIC clock. --- tests/acutest.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/acutest.h b/tests/acutest.h index 26d961e7..7f0fc059 100644 --- a/tests/acutest.h +++ b/tests/acutest.h @@ -384,12 +384,7 @@ static jmp_buf test_abort_jmp_buf__; test_timer_init__(void) { if(test_timer__ == 1) - #ifdef CLOCK_MONOTONIC_RAWxx - /* linux specific; not subject of NTP adjustments or adjtime() */ - test_timer_id__ = CLOCK_MONOTONIC_RAW; - #else test_timer_id__ = CLOCK_MONOTONIC; - #endif else if(test_timer__ == 2) test_timer_id__ = CLOCK_PROCESS_CPUTIME_ID; } @@ -407,14 +402,14 @@ static jmp_buf test_abort_jmp_buf__; double startns; endns = end.tv_sec; - endns *= 10e9; + endns *= 1e9; endns += end.tv_nsec; startns = start.tv_sec; - startns *= 10e9; + startns *= 1e9; startns += start.tv_nsec; - return ((endns - startns)/ 10e9); + return ((endns - startns)/ 1e9); } static void -- cgit v1.2.3-70-g09d2