2017-01-20 08:36:52 -05:00
|
|
|
#pragma once
|
|
|
|
|
2017-01-19 16:23:59 -05:00
|
|
|
namespace Utils
|
|
|
|
{
|
|
|
|
namespace Time
|
|
|
|
{
|
|
|
|
class Interval
|
|
|
|
{
|
2017-06-25 15:54:35 -04:00
|
|
|
protected:
|
2017-01-19 16:23:59 -05:00
|
|
|
std::chrono::high_resolution_clock::time_point lastPoint;
|
|
|
|
|
|
|
|
public:
|
|
|
|
Interval() : lastPoint(std::chrono::high_resolution_clock::now()) {}
|
|
|
|
|
|
|
|
void update();
|
|
|
|
bool elapsed(std::chrono::nanoseconds nsecs);
|
|
|
|
};
|
2017-06-25 15:54:35 -04:00
|
|
|
|
2017-06-26 17:23:08 -04:00
|
|
|
class Point
|
2017-06-25 15:54:35 -04:00
|
|
|
{
|
|
|
|
public:
|
2017-06-26 17:23:08 -04:00
|
|
|
Point();
|
2017-06-25 15:54:35 -04:00
|
|
|
|
2017-06-26 17:23:08 -04:00
|
|
|
void update();
|
|
|
|
int diff(Point point);
|
2017-06-25 15:54:35 -04:00
|
|
|
bool after(Point point);
|
2017-06-26 17:23:08 -04:00
|
|
|
bool elapsed(int milliseconds);
|
|
|
|
|
|
|
|
private:
|
|
|
|
int lastPoint;
|
2017-06-25 15:54:35 -04:00
|
|
|
};
|
2017-01-19 16:23:59 -05:00
|
|
|
}
|
|
|
|
}
|