29 lines
587 B
C++
29 lines
587 B
C++
#ifndef FORTUNA_EVENT_SCHEDULER_IMPL_H
|
|
#define FORTUNA_EVENT_SCHEDULER_IMPL_H
|
|
|
|
#include "event_scheduler.h"
|
|
|
|
#include <chrono>
|
|
#include <thread>
|
|
|
|
namespace fortuna {
|
|
namespace accumulator {
|
|
|
|
class EventSchedulerImpl final : public EventScheduler {
|
|
private:
|
|
std::chrono::milliseconds delay;
|
|
|
|
public:
|
|
EventSchedulerImpl();
|
|
|
|
void schedule(const std::chrono::milliseconds& delay_ms) override {
|
|
auto now{std::chrono::system_clock::now()};
|
|
std::this_thread::sleep_until(now + delay_ms);
|
|
}
|
|
};
|
|
|
|
} // namespace accumulator
|
|
} // namespace fortuna
|
|
|
|
#endif // FORTUNA_EVENT_SCHEDULER_IMPL_H
|