Fixes for IRIX 32bit timmer on O2. From Tom Jolley.

This commit is contained in:
Robert Osfield 2002-08-08 21:36:22 +00:00
parent f0f40cbf88
commit 0c6991ea27
2 changed files with 24 additions and 11 deletions

View File

@ -67,6 +67,9 @@ class SG_EXPORT Timer {
unsigned long* _clockAddress_32;
unsigned long long* _clockAddress_64;
int _cycleCntrSize;
// for SGI machines with 32 bit clocks.
mutable unsigned long _lastClockValue;
mutable unsigned long long _rollOver;
# endif
};
@ -167,7 +170,15 @@ class SG_EXPORT Timer {
if ( _clockAddress_64 )
return *_clockAddress_64;
else
return *_clockAddress_32;
{
unsigned long clockValue = *_clockAddress_32;
if( _lastClockValue > clockValue )
{
_rollOver += 0x100000000L;
}
_lastClockValue = clockValue;
return _rollOver + clockValue;
}
}
}
}

View File

@ -157,6 +157,8 @@ using namespace osg;
_clockAddress_32 = 0;
_clockAddress_64 = 0;
_rollOver = 0;
_lastClockValue = 0;
if( (fd = open( "/dev/mmem", O_RDONLY )) < 0 )
{