diff options
author | Aki <please@ignore.pl> | 2021-10-03 16:51:12 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-10-03 16:51:12 +0200 |
commit | 104248aabf40b692231fccd1adf1a2a494f1589a (patch) | |
tree | 5eee42a18a9688b03b483aff5c2bedffb4fe8a6c /Stars45/MachineInfo.cpp | |
parent | ddd76aa4e1571c8d5965709db5c3cd47a89c9a38 (diff) | |
parent | d2f333bf998691760b8970c2784756d0fa81e820 (diff) | |
download | starshatter-104248aabf40b692231fccd1adf1a2a494f1589a.zip starshatter-104248aabf40b692231fccd1adf1a2a494f1589a.tar.gz starshatter-104248aabf40b692231fccd1adf1a2a494f1589a.tar.bz2 |
Stars45 can now be built under MSYS2/Mingw32
Diffstat (limited to 'Stars45/MachineInfo.cpp')
-rw-r--r-- | Stars45/MachineInfo.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Stars45/MachineInfo.cpp b/Stars45/MachineInfo.cpp index 6b9e2cd..7485ac3 100644 --- a/Stars45/MachineInfo.cpp +++ b/Stars45/MachineInfo.cpp @@ -36,9 +36,10 @@ Collect and Display Machine, OS, and Driver Information */ +#include <chrono> + #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<double> diff = after - before; + double clocks = diff.count(); return (clocks/seconds); } @@ -682,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, |