Implement some syscalls

This commit is contained in:
momo5502
2024-08-18 18:50:38 +02:00
parent 6a2b423e5b
commit f2e29dc665
10 changed files with 830 additions and 50 deletions

View File

@@ -0,0 +1,26 @@
#pragma once
#include <chrono>
namespace utils
{
template <typename Clock = std::chrono::high_resolution_clock>
class timer
{
public:
void update()
{
this->point_ = Clock::now();
}
bool has_elapsed(typename Clock::duration duration) const
{
const auto now = Clock::now();
const auto diff = now - this->point_;
return diff > duration;
}
private:
typename Clock::time_point point_{ Clock::now() };
};
}