time: fix sys_mono_now for the JS backend (#12187)

pull/12198/head
playX 2021-10-15 09:22:15 +03:00 committed by GitHub
parent c29a5cdedb
commit d3887c1568
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -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 {