diff --git a/src/LinearMath/btQuickprof.cpp b/src/LinearMath/btQuickprof.cpp index 44e212f31..4a2e58aef 100644 --- a/src/LinearMath/btQuickprof.cpp +++ b/src/LinearMath/btQuickprof.cpp @@ -237,6 +237,14 @@ unsigned long int btClock::getTimeMicroseconds() +/// Returns the time in s since the last call to reset or since +/// the Clock was created. +btScalar btClock::getTimeSeconds() +{ + static const btScalar microseconds_to_seconds = btScalar(0.000001); + return btScalar(getTimeMicroseconds()) * microseconds_to_seconds; +} + inline void Profile_Get_Ticks(unsigned long int * ticks) diff --git a/src/LinearMath/btQuickprof.h b/src/LinearMath/btQuickprof.h index 93f3f4a60..362f62d6d 100644 --- a/src/LinearMath/btQuickprof.h +++ b/src/LinearMath/btQuickprof.h @@ -52,6 +52,11 @@ public: /// Returns the time in us since the last call to reset or since /// the Clock was created. unsigned long int getTimeMicroseconds(); + + /// Returns the time in s since the last call to reset or since + /// the Clock was created. + btScalar getTimeSeconds(); + private: struct btClockData* m_data; };