diff options
Diffstat (limited to 'cli/rt')
-rw-r--r-- | cli/rt/11_timers.js | 5 | ||||
-rw-r--r-- | cli/rt/40_performance.js | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/cli/rt/11_timers.js b/cli/rt/11_timers.js index c762c59d8..5a59844a3 100644 --- a/cli/rt/11_timers.js +++ b/cli/rt/11_timers.js @@ -3,6 +3,7 @@ ((window) => { const assert = window.__bootstrap.util.assert; const core = window.Deno.core; + const { sendSync } = window.__bootstrap.dispatchMinimal; function opStopGlobalTimer() { core.jsonOpSync("op_global_timer_stop"); @@ -16,8 +17,10 @@ await core.jsonOpAsync("op_global_timer"); } + const nowBytes = new Uint8Array(8); function opNow() { - return core.jsonOpSync("op_now"); + sendSync("op_now", 0, nowBytes); + return new DataView(nowBytes.buffer).getFloat64(); } function sleepSync(millis = 0) { diff --git a/cli/rt/40_performance.js b/cli/rt/40_performance.js index 3d8be6031..0a63dc704 100644 --- a/cli/rt/40_performance.js +++ b/cli/rt/40_performance.js @@ -43,8 +43,7 @@ } function now() { - const res = opNow(); - return res.seconds * 1e3 + res.subsecNanos / 1e6; + return opNow(); } class PerformanceEntry { |