1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:28:12 +00:00

LibWeb: Allow performance timestamps to have sub-millisecond precision

Rather than returning the number of whole elapsed milliseconds, we now
return the number of elapsed nanoseconds divided by one million. This
allows us to make use of the fractional part of the double that is
returned.
This commit is contained in:
Tim Ledbetter 2024-02-26 17:52:03 +00:00 committed by Andrew Kaster
parent 05c571bf9b
commit ee765e241e
2 changed files with 2 additions and 2 deletions

View file

@ -52,7 +52,7 @@ JS::GCPtr<NavigationTiming::PerformanceTiming> Performance::timing()
double Performance::time_origin() const
{
return static_cast<double>(m_timer.origin_time().milliseconds());
return static_cast<double>(m_timer.origin_time().nanoseconds()) / 1e6;
}
// https://w3c.github.io/user-timing/#mark-method