Update time procedures for js targets

This commit is contained in:
gingerBill
2022-05-21 16:35:06 +01:00
parent 72fcf16a39
commit 577fa2d29b
2 changed files with 27 additions and 8 deletions
+10
View File
@@ -1280,8 +1280,18 @@ function odinSetupDefaultImports(wasmMemoryInterface, consoleElement) {
evaluate: (str_ptr, str_len) => { eval.call(null, wasmMemoryInterface.loadString(str_ptr, str_len)); },
time_now: () => {
// convert ms to ns
return Date.now() * 1e6;
},
time_tick_now: () => {
// convert ms to ns
return performance.now() * 1e6;
},
time_sleep: (duration_ms) => {
if (duration_ms > 0) {
// TODO(bill): Does this even make any sense?
}
},
sqrt: (x) => Math.sqrt(x),
sin: (x) => Math.sin(x),