QT 5.6.0
Hello,
I'm using a time delay in my program, and noticed a drastic difference
in execution time between Windows 10 and Windows 7 (Dual boot system).
The time delay does not have to accurate (Animation).
Typical output:-
15156535 Windows 10
1379155 Windows 7
Its probably the processEvents, I would like the system to be responsive.
Is there a better way to achive similar results between the two systems?
Regards
void myProg:tDelay(int milliSecs)
{
QElapsedTimer timer;
timer.restart();
qint64 nanoSec;
timer.start();
QTime dieTime
= QTime::currentTime().
addMSecs(milliSecs
);
while (QTime::currentTime() < dieTime
)
nanoSec = timer.nsecsElapsed();
qDebug() << nanoSec;
}
void myProg:tDelay(int milliSecs)
{
QElapsedTimer timer;
timer.restart();
qint64 nanoSec;
timer.start();
QTime dieTime = QTime::currentTime().addMSecs(milliSecs);
while (QTime::currentTime() < dieTime)
QCoreApplication::processEvents(QEventLoop::AllEvents, 1);
nanoSec = timer.nsecsElapsed();
qDebug() << nanoSec;
}
To copy to clipboard, switch view to plain text mode
Bookmarks