From 6a84c8f802143fe273e66ffa995fea5b4565ea24 Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Sun, 2 Aug 2020 21:04:35 -0700 Subject: [PATCH] Fix system.GetTime() and SACT2.Timer_Get() Fixes slow animations in Sengoku Rance (and presumably other games). --- src/vm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vm.c b/src/vm.c index 8f1f560..33ac55f 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1662,7 +1662,9 @@ noreturn void _vm_error(const char *fmt, ...) int vm_time(void) { - return clock() / (CLOCKS_PER_SEC / 1000); + struct timespec ts; + clock_gettime(CLOCK_MONOTONIC, &ts); + return (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000); } #ifdef DEBUG_HEAP