From 94b1f202b6d5b6aeb350ef73444ba26e2da02950 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 12 May 2010 11:44:28 +0200 Subject: [PATCH] Fixed: #889 NLMISC ticksToSecond error on Mac OS X (patch provided by rti) --- code/nel/src/misc/time_nl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/code/nel/src/misc/time_nl.cpp b/code/nel/src/misc/time_nl.cpp index cc9d7cbb0..ea4c65b0f 100644 --- a/code/nel/src/misc/time_nl.cpp +++ b/code/nel/src/misc/time_nl.cpp @@ -222,9 +222,13 @@ double CTime::ticksToSecond (TTicks ticks) else #elif defined(NL_OS_MAC) { - static mach_timebase_info_data_t tbInfo; - if(tbInfo.denom == 0) mach_timebase_info(&tbInfo); - return double(ticks * tbInfo.numer / tbInfo.denom)/1000000.0; + static double factor = 0.0; + if (factor == 0.0) + { + mach_timebase_info_data_t tbInfo; + factor = 1000000000.0 * (double)tbInfo.numer / (double)tbInfo.denom; + } + return double(ticks * factor); } #endif // NL_OS_WINDOWS {