From 3503dd2f172cc4fe1dbb238123734c4b9513915d Mon Sep 17 00:00:00 2001 From: Thomas Green Date: Tue, 20 Jul 2021 23:51:17 +0100 Subject: [PATCH] Use integer to obtain cpufrequency in OSX Using a double to try to obtain cpufrequency in OSX seems to not produce anything useful (integer representation in a double). Using int64 seems to work. --- neo/sys/posix/platform_osx.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/neo/sys/posix/platform_osx.cpp b/neo/sys/posix/platform_osx.cpp index 00c49ebd..f1805f06 100644 --- a/neo/sys/posix/platform_osx.cpp +++ b/neo/sys/posix/platform_osx.cpp @@ -97,7 +97,8 @@ double Sys_ClockTicksPerSecond() { static bool init = false; static double ret; - size_t len = sizeof( ret ); + int64_t temp; + size_t len = sizeof( temp ); int status; if( init ) @@ -105,7 +106,8 @@ double Sys_ClockTicksPerSecond() return ret; } - status = sysctlbyname( "hw.cpufrequency", &ret, &len, NULL, 0 ); + status = sysctlbyname( "hw.cpufrequency", &temp, &len, NULL, 0 ); + ret = double(temp); if( status == -1 ) {