Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

On Long Run QML Timer stops after 536870 iterations of 1 sec each



  • Hi All,
    I'm developing a application and expect it to run for 10 days continuously. but the animation & timer in my application comes to an abrupt halt after 536870 iteration's of 1 second each. This translates to approximately 5 days 19 hours & 13 Mins.

    after doing some research on google :), noticed that this number when translated to milli seconds
    536870 x 1000 = 536870000 (decimal) == approximately 0x20000000 (Hex)

    also noticed on
    http://fluxer.github.io/katana/d7/dee/classCalendarSystem.html
    &
    https://community.kde.org/Plasma/Locale
    QML Bindings for KLocale has a reference like UnixTime = 0x20000000

    example app

    import QtQuick 2.4
    import QtQuick.Window 2.2

    Item {
        id: mainWindow
        objectName: "testapp"
        width: 640
        height: 480
        visible: true
        property int count: 0
    
        Timer{
            id: testTimer
            interval: 1000
            repeat: true
            running: true
            onTriggered: {
                count++;
                console.log(" count is "+count);
            }
        }
    
        Rectangle {
            id: rotatingBox
            width: 100
            height: 100
            x: 200
            y: 200
            color: "red"
            RotationAnimator {
                target: rotatingBox;
                from: 0;
                to: 360;
                duration: 1000
                running: true
                loops: Animation.Infinite
            }
    
        }
    
    }
    

    If this issue rings bell to any body, your inputs are appreciated.

    Thanks in Advance,
    CS



  • @ChetanSuri said in On Long Run QML Timer stops after 536870 iterations of 1 sec each:

    10 days continuously

    Why not use a date time function to check start date and time and end when ten days have passed? Essentially the date time functions in your computer are already running a timer for you. You could even have it start the process at a specific time so after 10 days you know it will be done by 8am Monday for example. If your computer is synced to an external time source then you know that 10 days will be accurate as well.

    Looking at the code I don't see any reason why it would halt. Does the program quit or the timer stops firing? Or is the text buffer for the console.log message full? Try logging to a file maybe (might have to write c++ code for that).



  • @fcarney
    The program doe not quit but The timer stops firing.
    one thing that I have noticed is that if an event handler for key presses is added, it accepts the incoming keys. which means that the application is still active.

    between I am having the problem on version 5.4.3



  • Seems to be 29 bit overflow (0x1fffffff (536870911)). Not sure if it's a bug in timers.



  • This issue has been fixed in
    https://bugreports.qt.io/browse/QTBUG-45358

    closing this issue


Log in to reply