Fix JS bug in std/monotimes (#12499) [backport]

This commit is contained in:
Oscar Nihlgård
2019-10-24 11:24:26 +02:00
committed by Andreas Rumpf
parent 4ac100c912
commit 3d0c756a3c

View File

@@ -58,6 +58,7 @@ when defined(macosx):
when defined(js):
proc getJsTicks: float =
## Returns ticks in the unit seconds
{.emit: """
var isNode = typeof module !== 'undefined' && module.exports
@@ -66,7 +67,7 @@ when defined(js):
var time = process.hrtime()
return time[0] + time[1] / 1000000000;
} else {
return window.performance.now() * 1000000;
return window.performance.now() / 1000;
}
""".}