RosettaCodeData/Task/Time-a-function/AutoHotkey/time-a-function-2.ahk
Ingy döt Net 68f8f3e56b all tasks
2013-04-11 01:07:29 -07:00

14 lines
354 B
AutoHotkey

MsgBox % time("fx")
time(function, parameter=0){
SetBatchLines -1
DllCall("QueryPerformanceCounter", "Int64*", CounterBefore)
DllCall("QueryPerformanceFrequency", "Int64*", Freq)
%function%(parameter)
DllCall("QueryPerformanceCounter", "Int64*", CounterAfter)
return (CounterAfter-CounterBefore)/Freq * 1000 " milliseconds"
}
fx(){
Sleep 1000
}