#include <base/interfaces/adaptor-internal-services.h>
#include <base/separate-update-render/thread-synchronization.h>
#include <base/environment-options.h>
+#include <base/time-service.h>
namespace Dali
{
namespace
{
+const unsigned int NANOSECONDS_PER_SECOND( 1e+9 );
+const unsigned int NANOSECONDS_PER_MICROSECOND( 1000u );
const unsigned int MICROSECONDS_PER_SECOND( 1000000u );
const unsigned int TIME_PER_FRAME_IN_MICROSECONDS( 16667u );
const EnvironmentOptions& environmentOptions )
: mThreadSynchronization( sync ),
mCore( adaptorInterfaces.GetCore() ),
- mPlatformAbstraction( adaptorInterfaces.GetPlatformAbstractionInterface() ),
mVSyncMonitor( adaptorInterfaces.GetVSyncMonitorInterface() ),
mThread( NULL ),
mEnvironmentOptions( environmentOptions ),
unsigned int frameNumber( 0u ); // frameCount, updated when the thread is paused
unsigned int currentSequenceNumber( 0u ); // platform specific vsync sequence number (increments with each vsync)
- unsigned int currentSeconds( 0u ); // timestamp at latest sync
- unsigned int currentMicroseconds( 0u ); // timestamp at latest sync
- unsigned int seconds( 0u );
- unsigned int microseconds( 0u );
+ unsigned int currentSeconds( 0u ); // timestamp at latest sync
+ unsigned int currentMicroseconds( 0u ); // timestamp at latest sync
+ uint64_t seconds( 0u );
+ uint64_t microseconds( 0u );
bool validSync( true );
while( mThreadSynchronization.VSyncReady( validSync, frameNumber++, currentSeconds, currentMicroseconds, mNumberOfVSyncsPerRender ) )
else
{
// No..use software timer
- mPlatformAbstraction.GetTimeMicroseconds( seconds, microseconds );
+ uint64_t nanoseconds = 0;
+ TimeService::GetNanoseconds( nanoseconds );
+
+ seconds = nanoseconds / NANOSECONDS_PER_SECOND; // Convert to seconds
+ nanoseconds -= seconds * NANOSECONDS_PER_SECOND; // Only want remainder nanoseconds
+ microseconds = nanoseconds / NANOSECONDS_PER_MICROSECOND; // Convert to microseconds
unsigned int timeDelta( MICROSECONDS_PER_SECOND * (seconds - currentSeconds) );
if( microseconds < currentMicroseconds)