diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.cpp b/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.cpp index 0fa27c52d9f..c054af9b265 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.cpp +++ b/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.cpp @@ -27,6 +27,14 @@ DOMHighResTimeStamp coarsen_time(DOMHighResTimeStamp timestamp, bool cross_origi return timestamp; } +// https://w3c.github.io/hr-time/#dfn-current-high-resolution-time +DOMHighResTimeStamp current_high_resolution_time(JS::Object const& global) +{ + // The current high resolution time given a global object current global must return the result + // of relative high resolution time given unsafe shared current time and current global. + return HighResolutionTime::relative_high_resolution_time(HighResolutionTime::unsafe_shared_current_time(), global); +} + // https://w3c.github.io/hr-time/#dfn-relative-high-resolution-time DOMHighResTimeStamp relative_high_resolution_time(DOMHighResTimeStamp time, JS::Object const& global) { diff --git a/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.h b/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.h index 870301a0224..311f7b10f14 100644 --- a/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.h +++ b/Userland/Libraries/LibWeb/HighResolutionTime/TimeOrigin.h @@ -14,6 +14,7 @@ namespace Web::HighResolutionTime { DOMHighResTimeStamp get_time_origin_timestamp(JS::Object const&); DOMHighResTimeStamp coarsen_time(DOMHighResTimeStamp timestamp, bool cross_origin_isolated_capability = false); +DOMHighResTimeStamp current_high_resolution_time(JS::Object const&); DOMHighResTimeStamp relative_high_resolution_time(DOMHighResTimeStamp, JS::Object const&); DOMHighResTimeStamp relative_high_resolution_coarsen_time(DOMHighResTimeStamp, JS::Object const&); DOMHighResTimeStamp coarsened_shared_current_time(bool cross_origin_isolated_capability = false);