From 89738fd95db9949d4884895839d633e5fc4a32e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Nihlg=C3=A5rd?= Date: Thu, 24 Oct 2019 11:24:26 +0200 Subject: [PATCH] Fix JS bug in std/monotimes (#12499) [backport] (cherry picked from commit 3d0c756a3c87d23b4920ef2d1a0b161f42da5b87) --- lib/std/monotimes.nim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/std/monotimes.nim b/lib/std/monotimes.nim index d2d9717d7f..4c570d2ee5 100644 --- a/lib/std/monotimes.nim +++ b/lib/std/monotimes.nim @@ -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; } """.}