diff options
| author | Garrett D'Amore <garrett@damore.org> | 2019-12-27 20:15:26 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2019-12-27 20:20:40 -0800 |
| commit | e9ab4a6831c89f331bae2fbb6d879cc7e85c24b1 (patch) | |
| tree | 492f629af76d0a272ddf412a4bf7e92672c3b962 | |
| parent | 042a3732e86d119b7d8a2611a8962752345c3a94 (diff) | |
| download | nng-e9ab4a6831c89f331bae2fbb6d879cc7e85c24b1.tar.gz nng-e9ab4a6831c89f331bae2fbb6d879cc7e85c24b1.tar.bz2 nng-e9ab4a6831c89f331bae2fbb6d879cc7e85c24b1.zip | |
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.
| -rw-r--r-- | tests/acutest.h | 11 |
1 files 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 |
