Jump to content

Timer


Snook
 Share

Recommended Posts

Ok using the Sleep Function and by using this code

$begin = TimerInit()
sleep(3000)
$dif = TimerDiff($begin)
MsgBox(0,"Time Difference",$dif)
oÝ÷ ÚØ^)ÉèµìZrׯz¼­g¢²Ø^­ë(ìÈ­jj+zÞr+)¢áȬ­"¯zz0Y«#ºËp¢w^®'íêÞË(ëaxq©Ý¢ØZ¶Éè¶Ú¢je{¬+®*mx,)e±ªÞ)¢µçZºÚ"µÍÌÍØÚXÚÜÝ[HH^[ÚXÚÜÝ[J
ÍË

Í
ÎK

ÍBÚ[H ÌÍØÚXÚÜÝ[HH^[ÚXÚÜÝ[J
ÍË

Í
ÎK

ÍBTÛY
L
BÑ[[ÝÙS[ÝJLK
L
BÌÍØYÚ[H[Y[]

BÛY
JBÌÍÙYH[YY   ÌÍØYÚ[B^U
    ][ÝÕ[YI][ÝË ÌÍÙY
JBÙ[
    ][ÝÐI][ÝÊ

Link to comment
Share on other sites

  • Moderators

Stands to reason the time would not be exact every time. It takes time to move through the interpreter and depends on how fast/memory/and processes are using your system resources are at the moment you are running things.

You also need to divide your returns by 1000 to get the proper value:

Time = 0.00232739077173205

Time = 0.023152942622596

Time = 0.0118596078551882

Time = 0.00925424879419046

Time = 0.00302775911463593

Time = 0.0273518002986415

Time = 0.003409930591737

Time = 0.0111634299890069

Time = 0.0159710242502888

Time = 0.0063630992207111

Average Difference = 0.0113881233508728

1/100th of a second difference... not too shabby.

You can run the test for yourself:

ConsoleWrite(@LF)
Global $iCount = 0, $iAdd = 0, $nHold = ''
While $iCount < 10
    $begin = TimerInit()
    Sleep(3000)
    $dif = TimerDiff($begin)
    ConsoleWrite('Time = ' & (($dif / 1000) - 3) & @CRLF)
    $nHold &= (($dif / 1000) - 3) & Chr(1); Create a string that can be made into an array/Subtract the 3 seconds for sleep
    $iCount += 1
WEnd
$nHold = StringSplit(StringTrimRight($nHold, 1), Chr(1))
For $iCC = 1 To UBound($nHold) - 1
    $iAdd += ($nHold[$iCC] / (UBound($nHold) - 1))
Next
ConsoleWrite('Average Difference = ' & $iAdd & @LF)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Really, I don't think AutoIt is fast enough to get/use the times correctly in sync

Sort of why I gave up trying to program an All-Purpose Autoer in AutoIt.

Now C, that's a different story :P

Edited by BALA
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com
Link to comment
Share on other sites

  • Moderators

Really, I don't think AutoIt is fast enough to get/use the times correctly in sync

Sort of why I gave up trying to program an All-Purpose Autoer in AutoIt.

Now C, that's a different story :P

That's apparent.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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
 Share

  • Recently Browsing   0 members

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