mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
LibCore+LibWeb: Use AK::Time instead of timeval in Core::ElapsedTimer
This removes the direct dependency on sys/time.h from ElapsedTimer, and makes the code a lot cleaner by using the helpers from AK::Time for time math and getting the current timestamp.
This commit is contained in:
parent
82a01bf32f
commit
4afa6e264c
3 changed files with 12 additions and 26 deletions
|
@ -7,7 +7,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
namespace Core {
|
||||
|
||||
|
@ -23,17 +22,16 @@ public:
|
|||
bool is_valid() const { return m_valid; }
|
||||
void start();
|
||||
void reset();
|
||||
int elapsed() const;
|
||||
|
||||
i64 elapsed() const; // milliseconds
|
||||
Time elapsed_time() const;
|
||||
|
||||
const struct timeval& origin_time() const { return m_origin_time; }
|
||||
Time const& origin_time() const { return m_origin_time; }
|
||||
|
||||
private:
|
||||
Time m_origin_time {};
|
||||
bool m_precise { false };
|
||||
bool m_valid { false };
|
||||
struct timeval m_origin_time {
|
||||
0, 0
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue