From b8d81e561e0563971a14dbaf36387bbe31c79337 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 8 Dec 2000 21:49:21 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/task/Task.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/direct/src/task/Task.py b/direct/src/task/Task.py index 7f0a1a0c55..a8e09e5f5c 100644 --- a/direct/src/task/Task.py +++ b/direct/src/task/Task.py @@ -21,10 +21,6 @@ def getTimeFrame(): # Ask for the time last frame t = globalClock.getTime() - - # Set the clock to have last frame's time in case we were - # Paused at the prompt for a long time - globalClock.setTime(t) # Get the new frame count f = globalClock.getFrameCount() @@ -259,16 +255,24 @@ class TaskManager: return len(self.taskList) def run(self): + + # Set the clock to have last frame's time in case we were + # Paused at the prompt for a long time + t = globalClock.getTime() + globalClock.setTime(t) + self.running = 1 while self.running: try: - startTime = time.time() + startTime = globalClock.getRealTime() self.step() - finishTime = time.time() + finishTime = globalClock.getRealTime() # Max out the frame rate so we do not starve the cpu if (maxFps > 0): dt = finishTime - startTime - time.sleep(max(0, (1.0/maxFps)-dt)) + length = (1.0/maxFps)-dt + if (length > 0): + time.sleep(length) except KeyboardInterrupt: self.stop() except: