WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 12-14-2005, 11:26 AM
astull astull is offline
Member
 
Join Date: Dec 2005
Posts: 9
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.
Reply With Quote
  #2  
Old 12-14-2005, 11:34 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:20 AM.


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