From e22420f1f289c571ae4fbe8732ec9caa1922282d Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 2 Oct 2021 21:08:45 +0200 Subject: Replaced rdtsc with std clock --- Stars45/MachineInfo.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Stars45/MachineInfo.cpp') diff --git a/Stars45/MachineInfo.cpp b/Stars45/MachineInfo.cpp index 6b9e2cd..255fbb6 100644 --- a/Stars45/MachineInfo.cpp +++ b/Stars45/MachineInfo.cpp @@ -36,9 +36,10 @@ Collect and Display Machine, OS, and Driver Information */ +#include + #include "MemDebug.h" #include "MachineInfo.h" -#include "Timesnap.h" #define DIRECTINPUT_VERSION 0x0700 @@ -149,16 +150,13 @@ static double SpinWait(double target_time) static double CalcCpuSpeed() { - DWORD clock1 = 0; - DWORD clock2 = 0; - - TIMESNAP(clock1); + const auto before = std::chrono::high_resolution_clock::now(); double seconds = SpinWait(0.1); - TIMESNAP(clock2); - - double clocks = clock2 - clock1; + const auto after = std::chrono::high_resolution_clock::now(); + const std::chrono::duration diff = after - before; + double clocks = diff.count(); return (clocks/seconds); } -- cgit v1.1 From dee511588386db44ee134adf86b59ffa9a0a02fd Mon Sep 17 00:00:00 2001 From: Aki Date: Sat, 2 Oct 2021 21:12:54 +0200 Subject: Changed NULL to 0 where it was intended this way --- Stars45/MachineInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Stars45/MachineInfo.cpp') diff --git a/Stars45/MachineInfo.cpp b/Stars45/MachineInfo.cpp index 255fbb6..7485ac3 100644 --- a/Stars45/MachineInfo.cpp +++ b/Stars45/MachineInfo.cpp @@ -680,7 +680,7 @@ static void DescribeDriversNT(const char* sType) HKEY hkWin; char sVideo[256] = ""; char sDriver[256] = ""; - DWORD dwSize = NULL; + DWORD dwSize = 0; // find the pointer to the video driver: if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, -- cgit v1.1