From 5bd7ff14e298612787d1b2a9b4b1733571dda905 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 7 Oct 2024 21:20:48 +0200 Subject: [PATCH] fix time --- AutoOBSRPRestart.lua | 7 +++++-- monitor.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/AutoOBSRPRestart.lua b/AutoOBSRPRestart.lua index b1927c3..b0e1f33 100644 --- a/AutoOBSRPRestart.lua +++ b/AutoOBSRPRestart.lua @@ -4,7 +4,10 @@ local wait_time = 7200 -- Wait 2 hours before checks local idle_time = 120 -- Wait for any input in the last 2 minutes function script_description() - return "Automatically restarts the replay buffer when IDLE" + return [[ + Automatically restarts the replay buffer when IDLE + Author: Mylloon + ]] end function script_load() @@ -33,7 +36,7 @@ function check_idle() local current_time = os.time() local last_input_time = monitor.last_time_input_received() - if current_time - last_input_time >= wait_time then + if current_time - last_input_time >= idle_time then monitor.stop_hook() obs.timer_remove(check_idle) restart_replay_buffer() diff --git a/monitor.c b/monitor.c index 3366a47..3eb7cdc 100644 --- a/monitor.c +++ b/monitor.c @@ -7,7 +7,7 @@ HHOOK hKeyboardHook; LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HC_ACTION) { - last_input_time = GetTickCount(); + last_input_time = time(NULL); } return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);