From 532b9c0c5021d286affea5e488a3f111037bb5a7 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 27 May 2009 01:32:18 +0000 Subject: [PATCH] replace assertion with clamping --- panda/src/pipeline/threadSimpleManager.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/panda/src/pipeline/threadSimpleManager.cxx b/panda/src/pipeline/threadSimpleManager.cxx index 75581be334..2e82a152fd 100644 --- a/panda/src/pipeline/threadSimpleManager.cxx +++ b/panda/src/pipeline/threadSimpleManager.cxx @@ -682,8 +682,11 @@ do_timeslice_accounting(ThreadSimpleImpl *thread, double now) { << *thread->_parent_obj << " ran for " << elapsed << " s of " << thread->_stop_time - thread->_start_time << " requested.\n"; } - - nassertv(elapsed >= 0.0); + + // Clamp the elapsed time at 0. (If it's less than 0, the clock is + // running backwards, ick.) + elapsed = max(elapsed, 0.0); + unsigned int ticks = (unsigned int)(elapsed * _tick_scale + 0.5); thread->_run_ticks += ticks;