diff options
author | Florent Le Coz <louiz@louiz.org> | 2015-02-27 12:16:09 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2015-02-27 12:26:48 +0100 |
commit | d600a2843f1dbe3b1ba2dead9a020cc73d7d10ae (patch) | |
tree | a34da2e3c617a39a73f716b9a5dddbdfbc510df6 /src/utils/timed_events.cpp | |
parent | 1028d4d549b517c5b42bb0c30a410d1ab43c4cf3 (diff) | |
download | biboumi-d600a2843f1dbe3b1ba2dead9a020cc73d7d10ae.tar.gz biboumi-d600a2843f1dbe3b1ba2dead9a020cc73d7d10ae.tar.bz2 biboumi-d600a2843f1dbe3b1ba2dead9a020cc73d7d10ae.tar.xz biboumi-d600a2843f1dbe3b1ba2dead9a020cc73d7d10ae.zip |
Remove all the libs that are now in louloulibs
Diffstat (limited to 'src/utils/timed_events.cpp')
-rw-r--r-- | src/utils/timed_events.cpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/utils/timed_events.cpp b/src/utils/timed_events.cpp deleted file mode 100644 index 5010a3f..0000000 --- a/src/utils/timed_events.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include <utils/timed_events.hpp> - -TimedEvent::TimedEvent(std::chrono::steady_clock::time_point&& time_point, - std::function<void()> callback, const std::string& name): - time_point(std::move(time_point)), - callback(callback), - repeat(false), - repeat_delay(0), - name(name) -{ -} - -TimedEvent::TimedEvent(std::chrono::milliseconds&& duration, - std::function<void()> callback, const std::string& name): - time_point(std::chrono::steady_clock::now() + duration), - callback(callback), - repeat(true), - repeat_delay(std::move(duration)), - name(name) -{ -} - -TimedEvent::TimedEvent(TimedEvent&& other): - time_point(std::move(other.time_point)), - callback(std::move(other.callback)), - repeat(other.repeat), - repeat_delay(std::move(other.repeat_delay)), - name(std::move(other.name)) -{ -} - -TimedEvent::~TimedEvent() -{ -} - -bool TimedEvent::is_after(const TimedEvent& other) const -{ - return this->is_after(other.time_point); -} - -bool TimedEvent::is_after(const std::chrono::steady_clock::time_point& time_point) const -{ - return this->time_point >= time_point; -} - -std::chrono::milliseconds TimedEvent::get_timeout() const -{ - auto now = std::chrono::steady_clock::now(); - if (now > this->time_point) - return std::chrono::milliseconds(0); - return std::chrono::duration_cast<std::chrono::milliseconds>(this->time_point - now); -} - -void TimedEvent::execute() -{ - this->callback(); -} - -const std::string& TimedEvent::get_name() const -{ - return this->name; -} |