mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +00:00
LibCore+Utilities: Replace ElapsedTimer precise flag with an enum
Previously, `true` was passed into the ElapsedTimer constructor if a precise timer was required. We now use an enum to more explicitly specify whether we would like a precise or a coarse timer.
This commit is contained in:
parent
0f168d9ca2
commit
679fe00d10
5 changed files with 13 additions and 8 deletions
|
@ -20,7 +20,7 @@ ElapsedTimer ElapsedTimer::start_new()
|
|||
void ElapsedTimer::start()
|
||||
{
|
||||
m_valid = true;
|
||||
m_origin_time = m_precise ? MonotonicTime::now() : MonotonicTime::now_coarse();
|
||||
m_origin_time = m_timer_type == TimerType::Precise ? MonotonicTime::now() : MonotonicTime::now_coarse();
|
||||
}
|
||||
|
||||
void ElapsedTimer::reset()
|
||||
|
@ -36,7 +36,7 @@ i64 ElapsedTimer::elapsed_milliseconds() const
|
|||
Duration ElapsedTimer::elapsed_time() const
|
||||
{
|
||||
VERIFY(is_valid());
|
||||
auto now = m_precise ? MonotonicTime::now() : MonotonicTime::now_coarse();
|
||||
auto now = m_timer_type == TimerType::Precise ? MonotonicTime::now() : MonotonicTime::now_coarse();
|
||||
return now - m_origin_time;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue