mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibWeb: Implement performance.timeOrigin
This is the origin timestamp of the same monotonic clock used for the performance.now() timestamp. I got a little confused while implementing this, since the numbers are very low. That's because it uses the CLOCK_MONOTONIC system clock, which we start counting from 0 at boot. :^)
This commit is contained in:
parent
62785b7872
commit
18cff5e0be
Notes:
sideshowbarker
2024-07-19 02:07:45 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/18cff5e0be2
3 changed files with 8 additions and 0 deletions
|
@ -44,6 +44,12 @@ Performance::~Performance()
|
|||
{
|
||||
}
|
||||
|
||||
double Performance::time_origin() const
|
||||
{
|
||||
auto origin = m_timer.origin_time();
|
||||
return (origin.tv_sec * 1000.0) + (origin.tv_usec / 1000.0);
|
||||
}
|
||||
|
||||
void Performance::ref_event_target()
|
||||
{
|
||||
m_window.ref();
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
~Performance();
|
||||
|
||||
double now() const { return m_timer.elapsed(); }
|
||||
double time_origin() const;
|
||||
|
||||
virtual void ref_event_target() override;
|
||||
virtual void unref_event_target() override;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
interface Performance : EventTarget {
|
||||
double now();
|
||||
readonly attribute double timeOrigin;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue