core: move to steady_clock where applicable
avoid issues when system clock gets desynchronized or changed
This commit is contained in:
parent
918d8340af
commit
1d70962892
10 changed files with 31 additions and 31 deletions
|
|
@ -8,11 +8,11 @@
|
|||
|
||||
class CEventLoopTimer {
|
||||
public:
|
||||
CEventLoopTimer(std::optional<std::chrono::system_clock::duration> timeout, std::function<void(SP<CEventLoopTimer> self, void* data)> cb_, void* data_);
|
||||
CEventLoopTimer(std::optional<std::chrono::steady_clock::duration> 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::system_clock::duration> timeout);
|
||||
void updateTimeout(std::optional<std::chrono::steady_clock::duration> timeout);
|
||||
|
||||
void cancel();
|
||||
bool passed();
|
||||
|
|
@ -26,6 +26,6 @@ class CEventLoopTimer {
|
|||
private:
|
||||
std::function<void(SP<CEventLoopTimer> self, void* data)> cb;
|
||||
void* data = nullptr;
|
||||
std::optional<std::chrono::system_clock::time_point> expires;
|
||||
std::optional<std::chrono::steady_clock::time_point> expires;
|
||||
bool wasCancelled = false;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue