Important: Please read the Qt Code of Conduct -

Monotonic timer for waitconditions with Qt 4.8.6

  • Hi all!

    I have a problem with Qt 4.8.6 both on my board (iMX6 solo board) and on my PC (l-ubuntu 16.04). With version 4.8.6 of Qt, if I set the date before the time when threads start, all threads stops, until I report the date after the time when threads start.

    If I ask to Qt which type of clock are in use, It says to me that the clock is monotonic, but this is not the case...

    I have no problem using timers an waitcondition from glibc...

    Have you ever seen this problem?

    Any suggestion is really appreciated!

    Update: just to understand better I created a QtCreator project with three threads: the first one uses msleep to sleep for 1 sec, the second one uses a mutex timeout (mywait.wait(&mymutex, 1000);) to sleep for 1 sec, the third one uses a normal sleep from glibc to sleep 1 sec. I can send you this simple project, if you want, but I'm not able to attach it here, unfortunately. :(((

    If you run this program from a terminal, you can see the print from all the three threads. Then, open another terminal and set your system clock some minutes BEHIND (with a simple date +%T -s "xx:xx:xx" command). Now you can see, with Qt 4.8.5 and Qt 4.8.6, that the first two threads stops!

    If you try to ask to Qt which type of clock are in use (with QElapsedTimer::clockType() or QElapsedTimer::isMonotonic()) you will receive the response that the clock is monotonic...

    If you use Qt5 you will have not this problem...

    Is this a bug? Any idea about?

    Thanks a lot!

Log in to reply