WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Elapse timer (https://forum.worldviz.com/showthread.php?t=469)

astull 12-14-2005 11:26 AM

Elapse timer
 
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:
Code:

#Save start of event
startTime = time.clock()
.
.
.
#Calculate elapsed time
elapsed = time.clock() - startTime



All times are GMT -7. The time now is 03:33 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC