diff options
Diffstat (limited to 'ext/web/02_timers.js')
-rw-r--r-- | ext/web/02_timers.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/web/02_timers.js b/ext/web/02_timers.js index 07b9587ea..f703120e6 100644 --- a/ext/web/02_timers.js +++ b/ext/web/02_timers.js @@ -13,6 +13,7 @@ MapPrototypeGet, MapPrototypeHas, MapPrototypeSet, + Uint32Array, // deno-lint-ignore camelcase NumberPOSITIVE_INFINITY, PromisePrototypeThen, @@ -25,8 +26,14 @@ const { reportException } = window.__bootstrap.event; const { assert } = window.__bootstrap.infra; + let hr; function opNow() { - return ops.op_now(); + if (!hr) { + hr = new Uint32Array(2); + ops.op_now_set_buf(hr); + } + ops.op_now.fast(); + return (hr[0] * 1000 + hr[1] / 1e6); } // --------------------------------------------------------------------------- |