Computer Science Canada

Timing...

Author:  Piro24 [ 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

Author:  zylum [ Thu Oct 26, 2006 11:21 pm ]
Post 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.


: