diff options
author | Aki <please@ignore.pl> | 2021-10-02 21:08:45 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-10-02 21:08:45 +0200 |
commit | e22420f1f289c571ae4fbe8732ec9caa1922282d (patch) | |
tree | 3f80bfad364e4f419074b31f4d84bb87206368ba /Stars45/MachineInfo.cpp | |
parent | e9c3d5411eac83a9263fe911d9e946b17c1e966e (diff) | |
download | starshatter-e22420f1f289c571ae4fbe8732ec9caa1922282d.zip starshatter-e22420f1f289c571ae4fbe8732ec9caa1922282d.tar.gz starshatter-e22420f1f289c571ae4fbe8732ec9caa1922282d.tar.bz2 |
Replaced rdtsc with std clock
Diffstat (limited to 'Stars45/MachineInfo.cpp')
-rw-r--r-- | Stars45/MachineInfo.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
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 <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); } |