AutoXenon Posted October 27, 2022 Share Posted October 27, 2022 (edited) #NoTrayIcon Opt('GUIOnEventMode',1) GUICreate('System Uptime') Global $label = GUICtrlCreateLabel(' hrs min sec cts' & @CRLF & '(freq: Hz)',0,0,400) Global $kern32 = DllOpen('Kernel32.dll') Global Const $freq = DllCall($kern32, 'bool', 'QueryPerformanceFrequency', 'Int64*', Null)[1] GUICtrlSetFont($label, 9, 0, 0, "Consolas") GUISetState() GUISetOnEvent(-3,Quit) Local $tick,$sec While Sleep(10) $tick = DllCall($kern32, 'bool', 'QueryPerformanceCounter', 'Int64*', Null)[1] $sec = $tick/$freq GUICtrlSetData($label, Int($sec/3600) & ' hrs ' & Int(Mod($sec,3600)/60) & ' min ' & Int(Mod($sec,60)) & ' sec ' & Mod($tick,$freq) & ' cts' & @CRLF & '(freq: ' & $freq & ' Hz)') WEnd Func Quit() DllClose($kern32) Exit EndFunc 1. QueryPerformanceFrequency stays the same from system launch, so treat it as a constant 2. QueryPerformanceCounter is in cycles counts since system launch, so it is a reliable timestamp since the frequency reference doesn't change Edited October 27, 2022 by AutoXenon Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now