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:
parent
4afa6e264c
commit
ddf348daeb
8 changed files with 22 additions and 12 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue