Protect against clock skew on the server

This commit is contained in:
David Rose 2001-05-31 18:53:42 +00:00
parent 0f47f9fc83
commit 53369f4a45
1 changed files with 5 additions and 0 deletions

View File

@ -85,6 +85,10 @@ class Interval(DirectObject):
def play(self, t0=0.0, duration=0.0, scale=1.0):
""" play(t0, duration)
"""
# Make sure the start time is sensible.
if t0 > self.duration:
t0 = self.duration
# Kill ongoing play task
taskMgr.removeTasksNamed(self.name + '-play')
# Start new one
@ -100,6 +104,7 @@ class Interval(DirectObject):
# Otherwise use min of interval duration and offset + play duration
self.endTime = min(self.duration, self.offset + duration)
assert(t0 <= self.endTime)
# Spawn task
taskMgr.spawnMethodNamed(self.__playTask, self.name + '-play')