Sketch Timer and implement Interrupt support

This commit is contained in:
2023-01-06 15:18:35 +01:00
parent d0f52aa494
commit b9b3656180
6 changed files with 102 additions and 11 deletions

View File

@@ -0,0 +1,35 @@
#ifndef __JABYENGINE_TIMER_HPP__
#define __JABYENGINE_TIMER_HPP__
#include "../jabyengine_defines.h"
namespace JabyEngine {
class GlobalTime {
public:
class TimeStamp {
private:
size_t value;
constexpr TimeStamp(size_t value) : value(value) {}
public:
constexpr size_t milliseconds_to(const TimeStamp& ts) const {
return (ts.value - this->value);
}
friend class GlobalTime;
};
private:
static size_t global_counter;
public:
GlobalTime() = delete;
~GlobalTime() = delete;
static TimeStamp get_time_stamp() {
return TimeStamp(GlobalTime::global_counter);
}
};
}
#endif //!__JABYENGINE_TIMER_HPP__