Skip to content
Commit 36623368 authored by Keren Zhu's avatar Keren Zhu Committed by Chromium LUCI CQ
Browse files

[WebUI] Add chrome.timeTicks.nowInMicroseconds() to WebUI

Add chrome.timeTicks.nowInMicroseconds() to WebUI. It returns the
microseconds since the origin of TimeTicks as a BigInt. It is equivalent
of TimeTicks::Now().since_origin().InMicroseconds() in C++.

This function will facilitate calculating delta between TimeTicks
captured in browser and WebUI. This is currently not possible because
time units in JS (performance.now, Date) use different origins from
TimeTicks.

See more discussion in doc: go/timeticks-in-webui

Note: We can't expose TimeTicks's raw value as chrome.timeTicks.now().
because a) it will involve the banned TimeTicks::ToInternalValue(),
b) TimeTicks difference in JS becomes meaningless because it has no unit.

Bug: 1269417
Change-Id: I18a1868ce1c1f9498660c7298b038907d0fef25a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3331615


Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#958422}
parent 392eeb1a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment