mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +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
|
@ -10,12 +10,17 @@
|
|||
|
||||
namespace Core {
|
||||
|
||||
enum class TimerType {
|
||||
Precise,
|
||||
Coarse
|
||||
};
|
||||
|
||||
class ElapsedTimer {
|
||||
public:
|
||||
static ElapsedTimer start_new();
|
||||
|
||||
ElapsedTimer(bool precise = false)
|
||||
: m_precise(precise)
|
||||
ElapsedTimer(TimerType timer_type = TimerType::Coarse)
|
||||
: m_timer_type(timer_type)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,7 +41,7 @@ public:
|
|||
|
||||
private:
|
||||
MonotonicTime m_origin_time { MonotonicTime::now() };
|
||||
bool m_precise { false };
|
||||
TimerType m_timer_type { TimerType::Coarse };
|
||||
bool m_valid { false };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue