mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +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
Notes:
sideshowbarker
2024-07-17 03:03:15 +09:00
Author: https://github.com/ADKaster
Commit: 4afa6e264c
Pull-request: https://github.com/SerenityOS/serenity/pull/16771
Reviewed-by: https://github.com/kleinesfilmroellchen
Reviewed-by: https://github.com/linusg ✅
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