Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Timing...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Piro24




PostPosted: Thu Oct 26, 2006 9:11 pm   Post subject: Timing...

How do I get a timer to start for a certain part of my code...
For example, here I want to start the timer right after the mouse button is clicked. But is all it does it start timming from when the program starts...Which is not what I want.

Am I using it in the wrong place, or am I using the wrong subprogram?

code:
loop
    Mouse.Where (x, y, b)
    if b = 1 then
        clock (timer)
    end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: Thu Oct 26, 2006 11:21 pm   Post subject: (No subject)

well, what the clock() procedure does is tell you how many milliseconds elapsed since the program started. i am assuming you want a timer to measure how much time has elapsed from one part of your program to another. this can be done by first finding how much time elapsed at point A in your program as well as point B. the time taken for the program to reach point B from A would be the difference in times A and B.. ie TimeB - TimeA.

btw, i would recommend using the Time.Elapsed procedure rather than the clock() procedure.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: