diff options
| author | Vaxry <vaxry@vaxry.net> | 2025-04-16 01:37:48 +0100 |
|---|---|---|
| committer | Vaxry <vaxry@vaxry.net> | 2025-04-16 01:37:48 +0100 |
| commit | 877fb5b93ada9b25b4d2f5ca5f69370fa345f1ac (patch) | |
| tree | 5b52ad19c695590ae50c7adae06b8e3aeccf34c1 /src/managers/eventLoop/EventLoopTimer.hpp | |
| parent | 0e521788bcc414c9cf81648d3167757d83deb60f (diff) | |
time: move to stl's clocks and move timer
Diffstat (limited to 'src/managers/eventLoop/EventLoopTimer.hpp')
| -rw-r--r-- | src/managers/eventLoop/EventLoopTimer.hpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/managers/eventLoop/EventLoopTimer.hpp b/src/managers/eventLoop/EventLoopTimer.hpp index e5a8c5e3..d093cd6e 100644 --- a/src/managers/eventLoop/EventLoopTimer.hpp +++ b/src/managers/eventLoop/EventLoopTimer.hpp @@ -5,14 +5,15 @@ #include <optional> #include "../../helpers/memory/Memory.hpp" +#include "../../helpers/time/Time.hpp" class CEventLoopTimer { public: - CEventLoopTimer(std::optional<std::chrono::steady_clock::duration> timeout, std::function<void(SP<CEventLoopTimer> self, void* data)> cb_, void* data_); + CEventLoopTimer(std::optional<Time::steady_dur> timeout, std::function<void(SP<CEventLoopTimer> self, void* data)> cb_, void* data_); // if not specified, disarms. // if specified, arms. - void updateTimeout(std::optional<std::chrono::steady_clock::duration> timeout); + void updateTimeout(std::optional<Time::steady_dur> timeout); void cancel(); bool passed(); @@ -25,8 +26,8 @@ class CEventLoopTimer { void call(SP<CEventLoopTimer> self); private: - std::function<void(SP<CEventLoopTimer> self, void* data)> cb; - void* data = nullptr; - std::optional<std::chrono::steady_clock::time_point> expires; - bool wasCancelled = false; + std::function<void(SP<CEventLoopTimer> self, void* data)> m_cb; + void* m_data = nullptr; + std::optional<Time::steady_tp> m_expires; + bool m_wasCancelled = false; }; |
