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
#if defined ( __APPLE__ ) || defined ( __MACOSX )
NextEnd = mach_absolute_time();
NextEnd += Delay;
#else
clock_gettime ( CLOCK_MONOTONIC, &NextEnd );
NextEnd.tv_sec += Delay.tv_sec;
NextEnd.tv_nsec += Delay.tv_nsec;
#endif
NextEnd = NextEnd + Delay;
// start thread
QThread::start();
@ -166,14 +168,17 @@ void CHighPrecisionTimer::run()
// a timing drift)
#if defined ( __APPLE__ ) || defined ( __MACOSX )
mach_wait_until ( NextEnd );
NextEnd += Delay;
#else
clock_nanosleep ( CLOCK_MONOTONIC,
TIMER_ABSTIME,
&NextEnd,
NULL );
#endif
NextEnd = NextEnd + Delay;
NextEnd.tv_sec += Delay.tv_sec;
NextEnd.tv_nsec += Delay.tv_nsec;
#endif
}
}
#endif

View file

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