next try...

This commit is contained in:
Volker Fischer 2013-03-03 21:56:25 +00:00
parent 48708ba00c
commit f2d4cb3e17
2 changed files with 8 additions and 4 deletions

View file

@ -134,10 +134,12 @@ void CHighPrecisionTimer::Start()
// set initial end time // set initial end time
#if defined ( __APPLE__ ) || defined ( __MACOSX ) #if defined ( __APPLE__ ) || defined ( __MACOSX )
NextEnd = mach_absolute_time(); NextEnd = mach_absolute_time();
NextEnd += Delay;
#else #else
clock_gettime ( CLOCK_MONOTONIC, &NextEnd ); clock_gettime ( CLOCK_MONOTONIC, &NextEnd );
NextEnd.tv_sec += Delay.tv_sec;
NextEnd.tv_nsec += Delay.tv_nsec;
#endif #endif
NextEnd = NextEnd + Delay;
// start thread // start thread
QThread::start(); QThread::start();
@ -166,14 +168,17 @@ void CHighPrecisionTimer::run()
// a timing drift) // a timing drift)
#if defined ( __APPLE__ ) || defined ( __MACOSX ) #if defined ( __APPLE__ ) || defined ( __MACOSX )
mach_wait_until ( NextEnd ); mach_wait_until ( NextEnd );
NextEnd += Delay;
#else #else
clock_nanosleep ( CLOCK_MONOTONIC, clock_nanosleep ( CLOCK_MONOTONIC,
TIMER_ABSTIME, TIMER_ABSTIME,
&NextEnd, &NextEnd,
NULL ); NULL );
#endif
NextEnd = NextEnd + Delay; NextEnd.tv_sec += Delay.tv_sec;
NextEnd.tv_nsec += Delay.tv_nsec;
#endif
} }
} }
#endif #endif

View file

@ -77,7 +77,6 @@ signals:
# include <mach/mach_error.h> # include <mach/mach_error.h>
# include <mach/mach_time.h> # include <mach/mach_time.h>
#else #else
# include <time.h>
# include <sys/time.h> # include <sys/time.h>
#endif #endif