From eefeb3bb9309e0bf62c715530ce99912ffb5da4b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 23 Aug 2017 15:26:07 +0100 Subject: [PATCH] Fixed underflow issue --- include/osg/Timer | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/osg/Timer b/include/osg/Timer index c7eb77019..77330944b 100644 --- a/include/osg/Timer +++ b/include/osg/Timer @@ -56,7 +56,7 @@ class OSG_EXPORT Timer { inline double time_n() const { return delta_n(_startTick, tick()); } /** Get the time in seconds between timer ticks t1 and t2.*/ - inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerTick; } + inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (t2>t1) ? (double)(t2 - t1)*_secsPerTick : -(double)(t1 - t2)*_secsPerTick; } /** Get the time in milliseconds between timer ticks t1 and t2.*/ inline double delta_m( Timer_t t1, Timer_t t2 ) const { return delta_s(t1,t2)*1e3; }