From a4cf0c8b11ae7ed79acb003d78682051a6f726c6 Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Mon, 26 Dec 2016 22:00:39 -0800 Subject: [PATCH] Linux clock_gettime needs rt / librt, so put it behind BT_LINUX_REALTIME for now. --- src/LinearMath/btQuickprof.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/LinearMath/btQuickprof.cpp b/src/LinearMath/btQuickprof.cpp index 3fff218b3..522dd8bd1 100644 --- a/src/LinearMath/btQuickprof.cpp +++ b/src/LinearMath/btQuickprof.cpp @@ -56,7 +56,12 @@ #else //_WIN32 #include + +#ifdef BT_LINUX_REALTIME +//required linking against rt (librt) #include +#endif //BT_LINUX_REALTIME + #endif //_WIN32 #define mymin(a,b) (a > b ? a : b) @@ -248,16 +253,17 @@ unsigned long long int btClock::getTimeNanoseconds() #else//__APPLE__ +#ifdef BT_LINUX_REALTIME timespec ts; clock_gettime(CLOCK_REALTIME,&ts); return 1000000000*ts.tv_sec + ts.tv_nsec; - - - /* struct timeval currentTime; +#else + struct timeval currentTime; gettimeofday(¤tTime, 0); return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1e9 + (currentTime.tv_usec - m_data->mStartTime.tv_usec)*1000; - */ +#endif //BT_LINUX_REALTIME + #endif//__APPLE__ #endif//__CELLOS_LV2__ #endif