diff --git a/include/osg/Timer b/include/osg/Timer index cd167cd01..37f52b4d9 100644 --- a/include/osg/Timer +++ b/include/osg/Timer @@ -36,9 +36,9 @@ class SG_EXPORT Timer { #if defined __DARWIN_OSX__ || defined macintosh // PJA MAC OSX - inline Tick() pollutes namespace so badly // we cant compile, due to Carbon.h ... - Timer_t tick(); + Timer_t tick() const; #else - inline Timer_t tick(); + inline Timer_t tick() const; #endif inline double delta_s( Timer_t t1, Timer_t t2 ) const { return (double)(t2 - t1)*_secsPerClick; } @@ -67,7 +67,7 @@ class SG_EXPORT Timer { namespace osg{ - inline Timer_t Timer::tick( void ) + inline Timer_t Timer::tick( void ) const { if (_useStandardClock) return clock(); @@ -100,7 +100,7 @@ namespace osg{ namespace osg{ - inline Timer_t Timer::tick() + inline Timer_t Timer::tick() const { if (_useStandardClock) { @@ -122,7 +122,7 @@ namespace osg{ namespace osg{ - inline Timer_t Timer::tick() + inline Timer_t Timer::tick() const { if (_useStandardClock) { @@ -142,7 +142,7 @@ namespace osg{ #include namespace osg{ - inline Timer_t Timer::tick() + inline Timer_t Timer::tick() const { struct timeval tv; gettimeofday(&tv, NULL); @@ -156,7 +156,7 @@ namespace osg{ namespace osg{ - inline Timer_t Timer::tick( void ) { return std::clock(); } + inline Timer_t Timer::tick( void ) const { return std::clock(); } }; #endif diff --git a/src/osg/Timer.cpp b/src/osg/Timer.cpp index 7832d81a8..b6d7a1044 100644 --- a/src/osg/Timer.cpp +++ b/src/osg/Timer.cpp @@ -197,29 +197,31 @@ using namespace osg; } } + #elif defined (__DARWIN_OSX__) || defined (macintosh) -#if defined (__DARWIN_OSX__) - #include // do I really have to link against the Carbon framework just for this? -#else - #include - #include -#endif + #if defined (__DARWIN_OSX__) + #include // do I really have to link against the Carbon framework just for this? + #else + #include + #include + #endif -Timer_t Timer::tick(void) -{ - UnsignedWide usecs; - Microseconds(&usecs); - - return (usecs.hi * 4294967296.0) + usecs.lo; -} -Timer::Timer( void ) -{ - _useStandardClock = false; - _secsPerClick = 1e-6; // Carbon timer's precision. + Timer::Timer( void ) + { + _useStandardClock = false; + _secsPerClick = 1e-6; // Carbon timer's precision. -} + } + + Timer_t Timer::tick(void) const + { + UnsignedWide usecs; + Microseconds(&usecs); + + return (usecs.hi * 4294967296.0) + usecs.lo; + } #elif defined(unix)