Results 1 to 6 of 6

Thread: Accuracy of the timer in Qt

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Accuracy of the timer in Qt

    What better way to recommend the following tasks:
    There is a time event (HH: MM: SS: MS).
    It is necessary at this time, follow the steps.
    The accuracy should not affect validity of GUI.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Accuracy of the timer in Qt

    The accuracy of timers depends on the operating system. In general you will never have assurance that the call will be made exactly at the time specified. You can get very close to that value if you are using a real-time operating system but you can forget about it on regular Linux or Windows installations. Also note that Windows has a lower timer resolution that other systems (I don't know if you can tweak it).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Accuracy of the timer in Qt

    But if I set timer in a separate thread, and will catch the system time ... for example.. every 40ms then I will be able to get accuracy +/- 40ms ?

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Accuracy of the timer in Qt

    Quote Originally Posted by Fastman View Post
    But if I set timer in a separate thread, and will catch the system time ... for example.. every 40ms then I will be able to get accuracy +/- 40ms ?
    no, because also your thread can be blocked for lets say 2 seconds, and then you don't have a accuracy of 40ms. (And beside, I think QTimer uses a separate thread by itself)((and this solution is lesser accurate than simple use a QTimer direkt.))

    If you need a 100% accuracy you have to use a RTOS.

    Anyway, is your application really so time sensible?

  5. #5
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Accuracy of the timer in Qt

    Quote Originally Posted by Lykurg View Post
    no, because also your thread can be blocked for lets say 2 seconds, and then you don't have a accuracy of 40ms. (And beside, I think QTimer uses a separate thread by itself)((and this solution is lesser accurate than simple use a QTimer direkt.))

    If you need a 100% accuracy you have to use a RTOS.

    Anyway, is your application really so time sensible?
    thх for help.

    Yes .. the fact that is often required to surrender to the television control signal with an accuracy of 2-5 frames. If you are using a frame rate 25 .. then each frame is 40ms...

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Accuracy of the timer in Qt

    As far as I remember you can't get a better resolution that 50ms on some Windows systems, so aim for that. If your system doesn't do anything besides handling your application, it will do fine.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Current Time in msec accuracy in Qt for WinCE
    By funghy in forum Qt Programming
    Replies: 4
    Last Post: 22nd June 2009, 10:00
  2. watchdog timer implementation based on QTimer
    By araglin in forum Qt Programming
    Replies: 3
    Last Post: 18th May 2009, 15:34
  3. implemet a timer
    By adamatic in forum Qt Programming
    Replies: 12
    Last Post: 17th February 2009, 07:31
  4. how to enable a timer in a non-gui thread?
    By zeopha in forum Qt Programming
    Replies: 3
    Last Post: 5th August 2008, 09:29
  5. Thread(s) and socket, timer slots
    By stephdev1965 in forum Qt Programming
    Replies: 1
    Last Post: 8th November 2006, 14:04

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.