Jump to content

TimerDiff issue with some processors


Recommended Posts

One of my staff brought to my attention the following quote from the documentation for TimerDiff:


Some processors are known to cause the function to return incorrect result.

We use Autoit for some process control applications and often use TimerInit() and TimerDiff()  This is concerning to me.  Is there a list of processors know to have problems with TimerDiff()?  What is the nature of the problem?  Is it off by milliseconds or does it not work at all or what?

Thank you in advance. 

Edited by Zog
Link to comment
Share on other sites

Link to comment
Share on other sites

On 12/2/2022 at 1:03 PM, Zog said:

Is there a list of processors know to have problems with TimerDiff()?

Not that I can find.  Closest thing I found related to this issue is this: https://www.autoitscript.com/trac/autoit/ticket/2240

Edited by spudw2k
Link to comment
Share on other sites

@Nine - great idea.  Tomorrow I'll run the following on all the different configurations in the testing lab at work:

Local $absDiff = 0
Local $cumulativeDiff = 0
Local $signedDiff
For $i = 1 To 100
    $begin = TimerInit()
    $signedDiff = 5000-TimerDiff($begin)
    $absDiff = ABS($signedDiff)
    $cumulativeDiff = $cumulativeDiff+$absDiff
ConsoleWrite("Average difference="&$cumulativeDiff/100&@CRLF)

Perhaps anyone interested could do that as well and post their results.  My home PC is AMD Ryzen 7 5800 8-Core Processor 3.40 GHz.  I found the average difference over the 100 tests to be 4.27MS - which doesn't seem too broken to me.

I didn't realize this was a 10 year old issue

Link to comment
Share on other sites

In all fairness, just because there have been 10 years worth of new CPUs produced, doesn't mean this problem has gone away.  I don't think it is that widespread of an issue though.  You can always resort to using the time macros (@HOUR, @MIN, @SEC, @MSEC) if there are any significant time lapse measurement issues with TimerDiff.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...