Add Timer::disable() to be more explicit than set_next_date(TimePoint::max())

This commit is contained in:
Maxime Coste 2020-12-20 11:32:15 +11:00
parent c99731ebf1
commit e50b5fe137
2 changed files with 6 additions and 5 deletions

View File

@ -66,7 +66,8 @@ public:
~Timer();
TimePoint next_date() const { return m_date; }
void set_next_date(TimePoint date) { m_date = date; }
void set_next_date(TimePoint date) { m_date = date; }
void disable() { m_date = TimePoint::max(); }
void run(EventMode mode);
private:

View File

@ -214,8 +214,8 @@ public:
void on_disabled(bool temporary) override
{
m_idle_timer.set_next_date(TimePoint::max());
m_fs_check_timer.set_next_date(TimePoint::max());
m_idle_timer.disable();
m_fs_check_timer.disable();
if (not temporary and m_hooks_disabled)
{
@ -1136,7 +1136,7 @@ private:
if (not temporary)
context().print_status({});
m_idle_timer.set_next_date(TimePoint::max());
m_idle_timer.disable();
if (context().has_client())
context().client().menu_hide();
}
@ -1239,7 +1239,7 @@ public:
void on_disabled(bool temporary) override
{
m_idle_timer.set_next_date(TimePoint::max());
m_idle_timer.disable();
if (not temporary)
{