From 53369f4a45e9ef5bac18cac7f95472fa067dbff6 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 31 May 2001 18:53:42 +0000 Subject: [PATCH] Protect against clock skew on the server --- direct/src/interval/Interval.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/direct/src/interval/Interval.py b/direct/src/interval/Interval.py index 719ef4a6ac..2e6b843a96 100644 --- a/direct/src/interval/Interval.py +++ b/direct/src/interval/Interval.py @@ -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')