$ticks uses the Windows api function GetTickCount64.

This has been discussed and requested many times in the past, this function is limited to the accuracy of the system timer, typically 10-16ms.

I would like $ticks to be updated to use the the QueryPerformanceCounter function which has an accuracy of under 1ms.

Not only it provides way more accurate timing for daily timing task, but as suggested in previous thread, it simply allows for more.

Previous suggestions:
https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/4911/
https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/75913/
https://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/81320/
http://forums.mirc.com/ubbthreads.php/ubb/showflat/Number/147241/

I'm reading the value may be null, but I think it's fine to check QueryPerformanceCounter first, and if that comes out null, return the gettickscount64 value.

Note: since it returns a value that is not in millisecond, it cannot replace $ticks, we need a new identifier like $hticks for high-res ticks.

Last edited by Wims; 27/03/20 11:39 PM. Reason: $hticks

#mircscripting @ irc.swiftirc.net == the best mIRC help channel