AntiCheat refactoring part 7

?
This commit is contained in:
momo5502
2016-11-05 12:56:12 +01:00
parent b1f283a066
commit d32d58cc6f
8 changed files with 80 additions and 56 deletions

17
src/Utils/Time.cpp Normal file
View File

@ -0,0 +1,17 @@
#include "STDInclude.hpp"
namespace Utils
{
namespace Time
{
void Interval::Set()
{
this->LastPoint = std::chrono::high_resolution_clock::now();
}
bool Interval::Elapsed(std::chrono::nanoseconds nsecs)
{
return ((std::chrono::high_resolution_clock::now() - this->LastPoint) >= nsecs);
}
}
}

17
src/Utils/Time.hpp Normal file
View File

@ -0,0 +1,17 @@
namespace Utils
{
namespace Time
{
class Interval
{
private:
std::chrono::high_resolution_clock::time_point LastPoint;
public:
Interval() : LastPoint(std::chrono::high_resolution_clock::now()) {}
void Set();
bool Elapsed(std::chrono::nanoseconds nsecs);
};
}
}