mirror of
https://github.com/thunderbrewhq/common.git
synced 2025-12-12 11:12:29 +00:00
fix(time): use llabs and add include to <cmath>
This commit is contained in:
parent
0a514776ce
commit
98adb41e3c
1 changed files with 3 additions and 2 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include "common/time/Time.hpp"
|
||||
#include "common/processor/Processor.hpp"
|
||||
#include <windows.h>
|
||||
#include <cmath>
|
||||
|
||||
OsTimeManager::OsTimeManager(TimingMethod tm) {
|
||||
this->timingMethod = NotSet;
|
||||
|
|
@ -86,7 +87,7 @@ TimingMethod OsTimeManager::Calibrate() {
|
|||
}
|
||||
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER*>(&pc2));
|
||||
|
||||
if (std::abs(tc4 - static_cast<int64_t>(static_cast<double>(pc2 - pc1) / this->performanceFrequency * 1000.0) - tc2) >= 5) {
|
||||
if (std::llabs(tc4 - static_cast<int64_t>(static_cast<double>(pc2 - pc1) / this->performanceFrequency * 1000.0) - tc2) >= 5) {
|
||||
this->timingTestError = 3;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,4 +108,4 @@ uint64_t OsTimeManager::Snapshot() {
|
|||
return static_cast<uint64_t>((static_cast<double>(performanceCount) * this->scaleToMs) + this->timeBegin);
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue