mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 05:20:31 +00:00
Fix JS bug in std/monotimes (#12499) [backport]
(cherry picked from commit 3d0c756a3c)
This commit is contained in:
committed by
narimiran
parent
ab51a8e08b
commit
89738fd95d
@@ -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;
|
||||
}
|
||||
""".}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user