summaryrefslogtreecommitdiff
path: root/Userland/Demos/CatDog/CatDog.cpp
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2023-01-01 22:38:53 -0700
committerLinus Groh <mail@linusgroh.de>2023-01-07 14:51:04 +0100
commitddf348daeb6a572609b517d808637333f5563822 (patch)
treec0086a0b57726dbb6bc9029bf46479b20f4fad08 /Userland/Demos/CatDog/CatDog.cpp
parent4afa6e264c91764d27f8f0674b2835cd37ca90ab (diff)
downloadserenity-ddf348daeb6a572609b517d808637333f5563822.zip
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.
Diffstat (limited to 'Userland/Demos/CatDog/CatDog.cpp')
-rw-r--r--Userland/Demos/CatDog/CatDog.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Demos/CatDog/CatDog.cpp b/Userland/Demos/CatDog/CatDog.cpp
index ec6a14a817..5c84970112 100644
--- a/Userland/Demos/CatDog/CatDog.cpp
+++ b/Userland/Demos/CatDog/CatDog.cpp
@@ -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;