diff options
Diffstat (limited to 'canvas')
-rw-r--r-- | canvas/Library_canvastools.mk | 6 | ||||
-rw-r--r-- | canvas/source/tools/elapsedtime.cxx | 81 |
2 files changed, 2 insertions, 85 deletions
diff --git a/canvas/Library_canvastools.mk b/canvas/Library_canvastools.mk index 50658b362f6b..a87e53fd1043 100644 --- a/canvas/Library_canvastools.mk +++ b/canvas/Library_canvastools.mk @@ -69,10 +69,4 @@ $(eval $(call gb_Library_add_defs,canvastools,\ endif endif -ifeq ($(OS),WNT) -$(eval $(call gb_Library_use_system_win32_libs,canvastools,\ - winmm \ -)) -endif - # vim: set noet sw=4 ts=4: diff --git a/canvas/source/tools/elapsedtime.cxx b/canvas/source/tools/elapsedtime.cxx index e82df7dbe3fb..6cb7fd546a8e 100644 --- a/canvas/source/tools/elapsedtime.cxx +++ b/canvas/source/tools/elapsedtime.cxx @@ -19,28 +19,9 @@ #include <sal/config.h> -#include <osl/time.h> - #include <canvas/elapsedtime.hxx> -#if defined(_WIN32) - -#if defined _MSC_VER -#pragma warning(push,1) -#endif - -// TEMP!!! -// Awaiting corresponding functionality in OSL - -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <winbase.h> -#include <mmsystem.h> -#endif - -#if defined _MSC_VER -#pragma warning(pop) -#endif +#include <tools/time.hxx> #include <algorithm> #include <limits> @@ -48,69 +29,11 @@ namespace canvas { namespace tools { - -#if defined(_WIN32) -// TODO(Q2): is 0 okay for the failure case here? double ElapsedTime::getSystemTime() { - // TEMP!!! - // Awaiting corresponding functionality in OSL - - - // is there a performance counter available? - static bool bTimeSetupDone( false ); - static bool bPerfTimerAvailable( false ); - static LONGLONG nPerfCountFreq; - - // TODO(F1): This _might_ cause problems, as it prevents correct - // time handling for very long lifetimes of this class's - // surrounding component in memory. When the difference between - // current sys time and nInitialCount exceeds IEEE double's - // mantissa, time will start to run jerky. - static LONGLONG nInitialCount; - - if( !bTimeSetupDone ) - { - if( QueryPerformanceFrequency( - reinterpret_cast<LARGE_INTEGER *>(&nPerfCountFreq) ) ) - { - // read initial time: - QueryPerformanceCounter( - reinterpret_cast<LARGE_INTEGER *>(&nInitialCount) ); - bPerfTimerAvailable = true; - } - bTimeSetupDone = true; - } - - if( bPerfTimerAvailable ) - { - LONGLONG nCurrCount; - QueryPerformanceCounter( - reinterpret_cast<LARGE_INTEGER *>(&nCurrCount) ); - nCurrCount -= nInitialCount; - return double(nCurrCount) / nPerfCountFreq; - } - else - { - LONGLONG nCurrTime = timeGetTime(); - return double(nCurrTime) / 1000.0; - } + return ::tools::Time::GetMonotonicTicks() / 1.0E6; } -#else // ! WNT - -// TODO(Q2): is 0 okay for the failure case here? -double ElapsedTime::getSystemTime() -{ - TimeValue aTimeVal; - if( osl_getSystemTime( &aTimeVal ) ) - return ((aTimeVal.Nanosec * 10e-10) + aTimeVal.Seconds); - else - return 0.0; -} - -#endif - ElapsedTime::ElapsedTime() : m_pTimeBase(), m_fLastQueriedTime( 0.0 ), |