diff --git a/src/common/utils/time.hpp b/src/common/utils/time.hpp index 07774107..25236fe0 100644 --- a/src/common/utils/time.hpp +++ b/src/common/utils/time.hpp @@ -4,11 +4,9 @@ #include "../platform/platform.hpp" #if defined(_MSC_VER) -#define ARCH_x86 #include #pragma intrinsic(__rdtsc) #elif defined(__x86_64__) || defined(__i386__) || defined(__amd64__) -#define ARCH_x86 #include #endif @@ -42,10 +40,14 @@ namespace utils /// TODO: find better solution for ARM and Figure out better CPU base frequency heuristics virtual uint64_t timestamp_counter() { -#if defined(ARCH_x86) - return __rdtsc(); -#endif // We are using x86, regardless of compiler the instrinsic is the same +#if defined(_MSC_VER) +#if defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86) + return __rdtsc(); // 64-bit with MSVC intrinsic +#endif +#elif defined(__x86_64__) || defined(__i386__) || defined(__amd64__) // If we are using clang or gcc + return __rdtsc(); // 64-bit with clang/gcc intrinsic +#endif int64_t count = std::chrono::high_resolution_clock::now().time_since_epoch().count(); return static_cast((count * 38LL) / 10LL); }