MvGulik Posted September 30, 2011 Share Posted September 30, 2011 (edited) I wonder why TimerInit() is returning a Float instead of a Int.As: Windows, as in 'QueryPerformanceCounter', is returning it as a Int. (LARGE_INTEGER) So:If AutoIt is not using 'QueryPerformanceCounter' to get the target value. What is it using? (or: additional info on reason(s) for it to be a float) If AutoIt is using 'QueryPerformanceCounter' ... The only thing that makes sense to me here is that TimerInit() was implemented before 64bit value support where implemented. (in which case the question comes down to 'why not update TimerInit() to make use of the 64bit value support.) As Valiks closing comment on ticket 2008 seems to be related to TimerDiff() (which was not the subject of the ticket) its not helping in this matter. The general benefits would be minor. Seemingly more consistency in the returned TimerInit() data(type) in relation to windows 'QueryPerformanceCounter' and a little speedup in special AutoIt timer scripts. (Int versus float math. ... assuming of course.) Ticket: #2008MSDN: QueryPerformanceFrequency Edited September 30, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
jvanegmond Posted September 30, 2011 Share Posted September 30, 2011 (edited) In the v3.1.0 download of the AutoIt source code, the function TimerInit is in src/script_misc.cpp. It uses QueryPerformanceCounter on a __int64 and converts that to double. There are no documented changes in the History page for TimerInit/TimerDiff after 2004. Edited September 30, 2011 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
MvGulik Posted September 30, 2011 Author Share Posted September 30, 2011 (edited) aha, thanks. Additional data: (pulled from online beta history) 3.1.0 (7th February, 2005) (Release)- Changed: (Internal) Variant rewrite (now handles int32, int64, double, string, HWND data) 3.0.102 (4th August, 2004) (Release)- Changed: TimerStart() renamed to TimerInit(). TimerStop() renamed to TimerDiff() 3.0.70 ... (last date on: v3.0.75 (30th November, 2003))- Added: TimerStart(), TimerStop() So it seems as I anticipated. ... Edited September 30, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
MvGulik Posted October 2, 2011 Author Share Posted October 2, 2011 Added it as Request to tracker. #2025 "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
trancexx Posted October 2, 2011 Share Posted October 2, 2011 VarGetType is great when used with sense. Used otherwise makes normal people wish it wouldn't exist at all. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
BrewManNH Posted October 2, 2011 Share Posted October 2, 2011 (edited) I'm not sure if this would be of any help in understanding what the timer functions are returning, but this article might help explain why it comes back as an float rather than an int. The value retrieved is an integer, but that's meaningless unless you know what the frequency of the counter is. The returned counter will give you a figure of how many ticks it counted, take that number and divide it by the ticks per second (the frequency) to get the time, this value is going to be a float. Edited October 2, 2011 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Valik Posted October 2, 2011 Share Posted October 2, 2011 (edited) From the ticket I just closed:If you use the return value from TimerInit() for anything other than an opaque handle to be passed to TimerDiff() then you are asking for trouble. Therefore the type is irrelevant. Ticket closed. Edited October 2, 2011 by Valik Link to comment Share on other sites More sharing options...
MvGulik Posted October 2, 2011 Author Share Posted October 2, 2011 (edited) Your closing it based on a presumption how I (or others) might be (mis)using it ?(I personally don't even use TimerDiff() in the case where I work directly with the TimerInit() data.) Would have been nice if you could have used one of the reasons I mentioned for the closure reason ...The general benefits would be minor. Seemingly more consistency in the returned TimerInit() data(type) in relation to windows 'QueryPerformanceCounter' and a little speedup in special AutoIt timer scripts. (Int versus float math. ... assuming of course.) But than I probably should have included them (as text) in the ticked if I read you right.O well. Edited October 2, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
Beege Posted October 3, 2011 Share Posted October 3, 2011 Your closing it based on a presumption how I (or others) might be (mis)using it ?I dont think its just that. Your asking them to change two functions for something that you even said "the benifits are minor". Plus since you can use DllCall() and 'QueryPerformanceCounter', theres already an alternative to using the autoit timer functions. Asking them to make changes that produce minor benifits and already has alternatives, is sure to get shot down. Assembly Code: fasmg . fasm . BmpSearch . Au3 Syntax Highlighter . Bounce Multithreading Example . IDispatchASMUDFs: Explorer Frame . ITaskBarList . Scrolling Line Graph . Tray Icon Bar Graph . Explorer Listview . Wiimote . WinSnap . Flicker Free Labels . iTunesPrograms: Ftp Explorer . Snipster . Network Meter . Resistance Calculator Link to comment Share on other sites More sharing options...
Valik Posted October 3, 2011 Share Posted October 3, 2011 (edited) I closed it because it's a fucking stupid request. You are trying to attach meaning to the return value of TimerInit() that we do not guarantee. The return value of TimerInit() should be treated as an opaque handle. That means the underlying type is irrelevant. If I want to make it a string that's my choice as a developer of AutoIt. All I have to ensure is that TimerDiff() still accepts that data and that TimerDiff() returns the calculated difference. There are no other guarantees about how either function works. I'm going to go adjust the documentation accordingly. Now shut the fuck up about this absolutely stupid and pointless subject. Edited October 3, 2011 by Valik Link to comment Share on other sites More sharing options...
MvGulik Posted October 3, 2011 Author Share Posted October 3, 2011 Now shut the fuck up about this absolutely stupid and pointless subject.Yea yea, I know, or else you just ban me for amusing you to much. [Left topic.] "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
wraithdu Posted October 3, 2011 Share Posted October 3, 2011 FYI, if you need a guaranteed return type, use _Timer_Init() and _Timer_Diff() from Timers.au3. They are wrappers for QueryPerformanceCounter and Init returns an int64. 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