1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-21 15:45:07 +00:00
serenity/Userland/Libraries/LibCore/ElapsedTimer.h
Nico Weber 197c5729d1 LibCore: Add ElapsedTimer::elapsed_milliseconds()
It does the same thing as elapsed(), but has a clearer name.
The hope is we'll move everything to the new name over time
and then remove the old name.
2023-05-24 15:50:43 +02:00

43 lines
794 B
C++

/*
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Time.h>
namespace Core {
class ElapsedTimer {
public:
static ElapsedTimer start_new();
ElapsedTimer(bool precise = false)
: m_precise(precise)
{
}
bool is_valid() const { return m_valid; }
void start();
void reset();
i64 elapsed_milliseconds() const;
Time elapsed_time() const;
// FIXME: Move callers to elapsed_milliseconds(), remove this.
i64 elapsed() const // milliseconds
{
return elapsed_milliseconds();
}
Time const& origin_time() const { return m_origin_time; }
private:
Time m_origin_time {};
bool m_precise { false };
bool m_valid { false };
};
}