Fixed: #889 NLMISC ticksToSecond error on Mac OS X (patch provided by rti)

This commit is contained in:
kervala 2010-05-12 11:44:28 +02:00
parent b8645f969f
commit 1c51331f5d

View file

@ -222,9 +222,13 @@ double CTime::ticksToSecond (TTicks ticks)
else else
#elif defined(NL_OS_MAC) #elif defined(NL_OS_MAC)
{ {
static mach_timebase_info_data_t tbInfo; static double factor = 0.0;
if(tbInfo.denom == 0) mach_timebase_info(&tbInfo); if (factor == 0.0)
return double(ticks * tbInfo.numer / tbInfo.denom)/1000000.0; {
mach_timebase_info_data_t tbInfo;
factor = 1000000000.0 * (double)tbInfo.numer / (double)tbInfo.denom;
}
return double(ticks * factor);
} }
#endif // NL_OS_WINDOWS #endif // NL_OS_WINDOWS
{ {