PDA

View Full Version : Elapse timer


astull
12-14-2005, 11:26 AM
I'm trying to build an elapse timer that will record the duration of a user event. I'm using the time.clock() function within a mousedown event to call the start time but I haven't been able to zero this for the next call. Am I using the wrong function? Any help would be welcome.:confused:

farshizzo
12-14-2005, 11:34 AM
Hi,

To calculate the elapsed time between two events, you need to save the start time using time.clock(). Once the event has ended take the current time using time.clock() again, and subtract the start time. This will give you the correct elapsed time. Here's some sample code:#Save start of event
startTime = time.clock()
.
.
.
#Calculate elapsed time
elapsed = time.clock() - startTime