mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-28 18:30:06 +00:00
Fix calling time.now() in wasm js runtime
This commit is contained in:
Vendored
+3
-8
@@ -1334,14 +1334,9 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement) {
|
||||
abort: () => { Module.abort() },
|
||||
evaluate: (str_ptr, str_len) => { eval.call(null, wasmMemoryInterface.loadString(str_ptr, str_len)); },
|
||||
|
||||
time_now: () => {
|
||||
// convert ms to ns
|
||||
return Date.now() * 1e6;
|
||||
},
|
||||
tick_now: () => {
|
||||
// convert ms to ns
|
||||
return performance.now() * 1e6;
|
||||
},
|
||||
// return a bigint to be converted to i64
|
||||
time_now: () => BigInt(Date.now()),
|
||||
tick_now: () => BigInt(performance.now()),
|
||||
time_sleep: (duration_ms) => {
|
||||
if (duration_ms > 0) {
|
||||
// TODO(bill): Does this even make any sense?
|
||||
|
||||
Reference in New Issue
Block a user