From ef3217cfde1d23f24774190ba1161b8bcb8bf538 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 30 Sep 2001 20:41:20 +0000 Subject: [PATCH] Interegrated changes to Timer from Neil Salter to fix compilation problems which had been introduced by doing #include's within the osg namespace. --- include/osg/Timer | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/include/osg/Timer b/include/osg/Timer index 694d21949..9dccbc55b 100644 --- a/include/osg/Timer +++ b/include/osg/Timer @@ -47,10 +47,14 @@ class SG_EXPORT Timer { }; +}; #ifdef WIN32 #include #pragma optimize("",off) + +namespace osg{ + inline Timer_t Timer::tick( void ) { if (_useStandardClock) return clock(); @@ -72,6 +76,8 @@ class SG_EXPORT Timer { *((unsigned int*)&ts+1) = HighPart; return ts; } + +}; #pragma optimize("",on) #elif defined(__linux) || defined(__FreeBSD__) @@ -79,6 +85,9 @@ class SG_EXPORT Timer { #include #define CLK(x) __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)) + +namespace osg{ + inline Timer_t Timer::tick() { if (_useStandardClock) @@ -92,10 +101,15 @@ class SG_EXPORT Timer { Timer_t x;CLK(x);return x; } } - + +}; + #elif defined(__sgi) #include + +namespace osg{ + inline Timer_t Timer::tick() { if (_useStandardClock) @@ -109,23 +123,30 @@ class SG_EXPORT Timer { return *_sgiClockAddress; } } +}; #elif defined(unix) #include + +namespace osg{ inline Timer_t Timer::tick() { struct timeval tv; gettimeofday(&tv, NULL); return ((osg::Timer_t)tv.tv_sec)*1000000+(osg::Timer_t)tv.tv_usec; } +}; #else // no choice, always use std::clock() + +namespace osg{ + inline Timer_t Timer::tick( void ) { return std::clock(); } - -#endif - }; + +#endif + #endif