1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:27:45 +00:00

Everywhere: Use ElapsedTimer::elapsed_time() for comparisons

Simplify a lot of uses of ElapsedTimer by converting the callers to
elapsed_time from elapsed, as the AK::Time returned is better for unit
conversions and comparisons against constants.
This commit is contained in:
Andrew Kaster 2023-01-01 22:38:53 -07:00 committed by Linus Groh
parent 4afa6e264c
commit ddf348daeb
8 changed files with 22 additions and 12 deletions

View file

@ -100,6 +100,8 @@ bool CatDog::is_inspector() const
void CatDog::timer_event(Core::TimerEvent&)
{
using namespace AK::TimeLiterals;
if (has_flag(m_state, State::Alert))
return;
@ -127,7 +129,7 @@ void CatDog::timer_event(Core::TimerEvent&)
if (has_any_flag(m_state, State::Directions)) {
m_idle_sleep_timer.start();
} else {
if (m_idle_sleep_timer.elapsed() > 5'000)
if (m_idle_sleep_timer.elapsed_time() > 5_sec)
m_state |= State::Sleeping;
else
m_state |= State::Idle;