Hi,
I have an application where I need to have precise (at millisecond) timing.
I know I cannot trust QTimer, since the app is quite big and I think using Qtimer I accumulate delays.
Let's say, I run a startTimer(5), if I check using QTime::currentTime(), I notice a delay around 10-15 ms instead of 5.
So I tried adding a simple QThread to the app, just to see if in another thread I can be more precise.
Qt Code:
void testThread::run() { while (!m_stop) { int elap = m_oldTime.msecsTo(m_currTime); m_oldTime = m_currTime; qDebug() << tt; msleep(10); } }To copy to clipboard, switch view to plain text mode
And even like this the delay is 15-16, sometimes 0 ! and if the app has some blocking operation even the thread is affected.
The Cpu is always at 50%, so am I doing something wrong?
Or that's normal? I would expect to have the thread runnig separatedly from the main process.
thanks for any idea
bye
Bookmarks