Results 1 to 5 of 5

Thread: Doubt about QTimer

  1. #1
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Doubt about QTimer

    Hi,
    I am using two timers in one button click event.
    1: will call a function for every 1ms and
    2: will call a function for every 3ms .
    The timer 1 will read data form port and insert into database and timer 2 will read data from database and do the functionality.
    Here my problem is whether one timer will slow down the process of other timer .I observed it is happening so.Here i need to run the two process with same speed with out slowing down.
    And one thing i need to clear is whether any QTimer function slow downs after some time ie after 15min.If so how to solve this problem.
    so please suggest and help me to solve these doubts(problems).


    With Regards,
    Sudheer

  2. #2
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Doubt about QTimer

    Hi,

    Are you sure that it is "QTimer" slowing down?
    Theoretically, there should be not loss of timer speed. Could you paste a bit of code where you create/use/connect your timers?

    Thanks,

    Kacper
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  3. #3
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Doubt about QTimer

    It should not slow down.
    But note that your linux probably is no real time OS and does not guarantee millisecond precision (and nor does Qt). If your machine is busy or your program's thread / process has bad luck with scheduling this time may (will) be larger.

    from QTimer's docs:
    Note that QTimer's accuracy depends on the underlying operating system and hardware. Most platforms support an accuracy of 1 millisecond, but Windows 98 supports only 55. If Qt is unable to deliver the requested number of timer clicks, it will silently discard some.
    HTH

  4. #4
    Join Date
    May 2007
    Location
    Lublin, Poland
    Posts
    345
    Thanks
    40
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Doubt about QTimer

    Yes, that's right.

    That sounds like would have to have a timer sending timeout() from another process to have a better precision.
    Did you think about other solutions not including QTimer ?

    Kacper
    Qt allows you to use everything you want
    wysota
    --------------------------------------------------------------------------------
    #if defined(Q_OS_UNIX) && defined(QT_DEBUG)
    abort(); // trap; generates core dump
    #else
    exit(1); // goodbye cruel world
    #endif

  5. #5
    Join Date
    Aug 2008
    Posts
    84
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Doubt about QTimer

    Thanks everybody for giving me reply

Similar Threads

  1. Replies: 8
    Last Post: 27th March 2013, 11:51
  2. Extending QTimer()
    By rishid in forum Qt Programming
    Replies: 3
    Last Post: 7th August 2009, 01:59
  3. QThread/QObject and QTimer
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 08:37
  4. Replies: 5
    Last Post: 6th March 2007, 05:34
  5. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.