Sven Posted April 5, 2012 Share Posted April 5, 2012 (edited) From the help file:TimerInitReturns a timestamp (in milliseconds)._Timer_InitReturns a timestamp (in milliseconds).Do they differ internally? Edited April 5, 2012 by Sven Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2012 Moderators Share Posted April 5, 2012 Sven,TimerInit is an native AutoIt function - so the last version where you can see the actual code used is v3.1.0 from 2005. Whether this remains unchanged in the current release version I have no idea._Timer_Init is a UDF function which calls the QueryPerformanceCounter function of kernel32.dll.I have never used the UDF function as the native version has always sufficed for my needs so I cannot comment on any differences in behaviour. However, I would not mix the two sets of function - if you use TimerInit then you should use TimerDiff to get the result. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Sven Posted April 5, 2012 Author Share Posted April 5, 2012 (edited) Thanks. They both seem to call QueryPerformanceCounter (3.1.0 source does at least) and they both seem equally precise. Since I'm not having any eureka! moments concerning the difference between the two I'm going to use the one that requires less typing Edited April 5, 2012 by Sven Link to comment Share on other sites More sharing options...
Zedna Posted April 5, 2012 Share Posted April 5, 2012 (edited) As far as I can remember with Timers from UDF you can achieve that your computing will not stop even during dragging/moving/resizing of your GUI window.There are some examples for that on this forum.EDIT:here is one example Edited April 5, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 5, 2012 Moderators Share Posted April 5, 2012 (edited) Sven,Sounds like a very reasonable decision! M23Zedna,Just seen your post. What you say is true for _Timer_SetTimer vs Adlib but here we are talking about measuring a delay from a fixed timestamp which can only be done within the running script and so there should be no difference - and there seems not to be:#include <GUIConstantsEx.au3> #include <Timers.au3> $hGUI = GUICreate("Test", 500, 500) $cLabel_Native = GUICtrlCreateLabel("0", 10, 10, 200, 20) $cLabel_UDF = GUICtrlCreateLabel("0", 10, 50, 200, 20) GUISetState() $iBegin_Native = TimerInit() $iBegin_UDF = _Timer_Init() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $iDelay_Native = Int(TimerDiff($iBegin_Native) / 1000) If $iDelay_Native <> GUICtrlRead($cLabel_Native) Then GUICtrlSetData($cLabel_Native, $iDelay_Native) EndIf $iDelay_UDF = Int(_Timer_Diff($iBegin_UDF) / 1000) If $iDelay_UDF <> GUICtrlRead($cLabel_UDF) Then GUICtrlSetData($cLabel_UDF, $iDelay_UDF) EndIf WEndAnd here is an example of using _Timer_SetTimer to get around a script pausing. Edited April 5, 2012 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zedna Posted April 5, 2012 Share Posted April 5, 2012 Zedna,Just seen your post. What you say is true for _Timer_SetTimer vs Adlib but here we are talking about measuring a delay from a fixed timestamp which can only be done within the running script and so there should be no difference - and there seems not to be:Of course you are right Melba :-) Resources UDF ResourcesEx UDF AutoIt Forum Search 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