1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +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

@ -252,6 +252,8 @@ void TextEditor::doubleclick_event(MouseEvent& event)
void TextEditor::mousedown_event(MouseEvent& event)
{
using namespace AK::TimeLiterals;
if (event.button() != MouseButton::Primary) {
return;
}
@ -262,7 +264,7 @@ void TextEditor::mousedown_event(MouseEvent& event)
if (is_displayonly())
return;
if (m_triple_click_timer.is_valid() && m_triple_click_timer.elapsed() < 250) {
if (m_triple_click_timer.is_valid() && m_triple_click_timer.elapsed_time() < 250_ms) {
m_triple_click_timer = Core::ElapsedTimer();
select_current_line();
return;