From 05b5e301870cd1448c495b16dc6eb2da2f5ffa78 Mon Sep 17 00:00:00 2001 From: Yaxun Sam Liu Date: Sun, 20 Jan 2019 00:04:24 -0500 Subject: [PATCH] Use chrono instead of sys/time.h in test sys/time.h is not available on Windows. Use C++11 instead so that the tests compile on Windows. --- tests/src/test_common.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/src/test_common.h b/tests/src/test_common.h index 40f6fffd8e..da5b47ea47 100644 --- a/tests/src/test_common.h +++ b/tests/src/test_common.h @@ -19,7 +19,7 @@ THE SOFTWARE. #include #include -#include +#include #include #include "hip/hip_runtime.h" @@ -105,9 +105,8 @@ namespace HipTest { // Returns the current system time in microseconds inline long long get_time() { - struct timeval tv; - gettimeofday(&tv, 0); - return (tv.tv_sec * 1000000) + tv.tv_usec; + return std::chrono::high_resolution_clock::now().time_since_epoch() + /std::chrono::microseconds(1); } double elapsed_time(long long startTimeUs, long long stopTimeUs);