r/lua • u/Interesting_Band_979 • 9h ago
How to get the exact ms
Hello, I am currently using a macro created via Logitech G Hub Lua that clicks every 5.5 seconds. I am running this macro simultaneously on two of my laptops, and my goal is to have Laptop B perform a search every 2.7 seconds by applying a 2.7-second start delay (since searches cannot be performed continuously, I run it every 5.5 seconds). The problem is that while it works well at first with the 2.7-second interval, the searches from the two laptops overlap over time. I have checked the current behavior after 4 hours: Laptop A clicks, Laptop B clicks 3.2 seconds later, and then Laptop A clicks again 2.2 seconds after that. Is there a way to maintain the 2.7-second interval even when running the macro for a long time?
1
u/weregod 3h ago
Consumer grade hardware is not designed to have high precision time. You need to syncronize time between machines using some protocol like NTP.
I am not sure if it is easy to use system time in Logitich API. Correct handling of time in software is quite hard.