ITAClock.cpp 747 Bytes
Newer Older
Jonas Stienen's avatar
Jonas Stienen committed
1 2 3 4 5 6 7 8 9 10 11 12 13
#include "ITAClock.h"

#ifndef WIN32
#define HAVE_POSIX
#endif

#include <ITAException.h>

#include <ITAWinPCClock.h>
#include <ITAPosixRealtimeClock.h>

static ITAClock* pDefaultClock = NULL;

14 15 16 17
ITAClock* ITAClock::getDefaultClock()
{
	if( !pDefaultClock )
	{
Jonas Stienen's avatar
Jonas Stienen committed
18 19 20 21 22 23 24 25 26
#ifdef WIN32
		// Standard auf Windows-Systemen: Windows Performance Counters
		pDefaultClock = ITAWinPCClock::getInstance();
#endif
#ifdef HAVE_POSIX
		// Standard on Posix systems: Real-time clock
		pDefaultClock = ITAPosixRealtimeClock::getInstance();
#endif
		// Kein Standard-Zeitgeber fr diese Plattform -> Ausnahme!
27
		if( !pDefaultClock ) ITA_EXCEPT1( NOT_IMPLEMENTED, "Could not create a default clock instance (activate HAVE_POSIX if available)" );
Jonas Stienen's avatar
Jonas Stienen committed
28 29 30 31
	}

	return pDefaultClock;
}