time: fix sys_mono_now for the JS backend (#12187)
parent
c29a5cdedb
commit
d3887c1568
|
@ -4,11 +4,11 @@ module time
|
||||||
#var $seen = 0
|
#var $seen = 0
|
||||||
#function $sys_mono_new_Date() {
|
#function $sys_mono_new_Date() {
|
||||||
#var t = Date.now()
|
#var t = Date.now()
|
||||||
#if (t < seen)
|
#if (t < $seen)
|
||||||
#timeOff += (seen - t)
|
#$timeOff += ($seen - t)
|
||||||
#
|
#
|
||||||
#seen = t
|
#$seen = t
|
||||||
#return t + timeOff
|
#return t + $timeOff
|
||||||
#}
|
#}
|
||||||
|
|
||||||
pub fn sys_mono_now() u64 {
|
pub fn sys_mono_now() u64 {
|
||||||
|
@ -19,7 +19,7 @@ pub fn sys_mono_now() u64 {
|
||||||
return res
|
return res
|
||||||
} $else $if js_node {
|
} $else $if js_node {
|
||||||
mut res := u64(0)
|
mut res := u64(0)
|
||||||
#res.val = Number($process.hrtime.bigint())
|
#res.val = $process.hrtime.bigint()
|
||||||
|
|
||||||
return res
|
return res
|
||||||
} $else {
|
} $else {
|
||||||
|
|
Loading…
Reference in New Issue