Opened 13 years ago
Closed 13 years ago
#2008 closed Bug (No Bug)
timerinit does not return int, returns imprecise float, differences bad
Reported by: | jmichae3@… | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.6.1 | Severity: | None |
Keywords: | Cc: |
Description
$a=int(TimerInit()) ;for some reason, timerinit returns a float rather than an int! very imprecise!!!
sleep(100)
$b=int(timerinit())
$c=$b-$a ;should be about 100, but result is always about 297 million to 299 million
MSGBOX(0,"TIMERINIT",$a&","&$b&","&$c)
I need an int. floats are useless to me. floats lose precision and are very imprecise (floating point error for instance).
I know there is a timerdiff for doing time differences, but timerdiff returns also a useless float, not a useful int.
I need an accurate result from timerinit if I am going to use it in my time calculations. please fix. thanks.
when using int() to wrap the timerinit function and do subtractions, should be about 100, but result is always about 297 million to 299 million.
Attachments (0)
Change History (4)
comment:1 Changed 13 years ago by mvg
comment:2 Changed 13 years ago by mvg
Bummer ...
BOOL WINAPI QueryPerformanceCounter( __out LARGE_INTEGER *lpPerformanceCount );
Or (also) see _Timer_Init()
?
(_Timer_Init() no match(speed) compared to TimerInit().)
comment:3 Changed 13 years ago by Beege
Are you listening to what your saying? How could a int returned be more accurate than a float? Your example uses timerinit() wrong so its kinda irrelevant.
$a=TimerInit();
sleep(100)
$b=TimerDiff($a)
$b = 99.3337961739871 on mine.
comment:4 Changed 13 years ago by Valik
- Resolution set to No Bug
- Status changed from new to closed
I'm not sure where you got your assumptions but they are flat out wrong. You cannot do what you are doing and expect to get meaningful values back. There is more to TimerDiff() than an internal call to TimerInit() to get a new timestamp and a simple subtraction. I suggest you use functions as documented or learn what the fuck you're talking about before wasting my time again.
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Your barking up the wrong tree. See creators of your OS.
And study the timer related pages at MSDN while your at it.