Results 1 to 4 of 4

Thread: QTimer Time Resolution

  1. #1
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default QTimer Time Resolution

    Hi
    Can u set the QTimer Time Resolution to be less then milisecond . Also can the interval value would be in double float etc

  2. #2
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTimer Time Resolution

    No and No.

    If you want accuracy of less than a millisecond, you need platform specific functions.

    What are you trying to do?

  3. #3
    Join Date
    Feb 2011
    Posts
    41
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTimer Time Resolution

    Hi
    So suppose i have choosen a variable of double for timeinterval and may be value less then 1 milisec lets take .2 so in this case the next timerevent will fire after completion of 1 milisec
    in this case there will 5 complete interval but timer event is called only after 1 mili sec or 5 times in amili sec

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QTimer Time Resolution

    so in this case the next timerevent will fire after completion of 1 milisec
    No.
    It will fire as the doc states:
    A QTimer with a timeout interval of 0 will time out as soon as all the events in the window system's event queue have been processed.
    Which can be any interval.

    In addition, saying that the QTimer will fire with 1 ms resolution is also not 100% correct.
    QTimer takes interval values in 1 ms resolution.
    The actual interval might, and usually does vary, depending on the current system and its state.
    Under windows, having a less than 1 ms timer resolution is probably not really practical/possible - I know wysota will laugh at the notion alone.
    You might find this interesting:
    http://www.qtcentre.org/threads/4031...Timer-accuracy
    And if you are on windows:
    http://msdn.microsoft.com/en-us/magazine/cc163996.aspx
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. Replies: 3
    Last Post: 26th November 2011, 11:09
  2. QTimer resolution.
    By Netich in forum Qt Programming
    Replies: 3
    Last Post: 31st March 2010, 19:08
  3. Total time in QTimer
    By martisho in forum Qt Programming
    Replies: 4
    Last Post: 14th November 2009, 08:24
  4. QObject::timerEvent() time resolution
    By Halabund in forum Qt Programming
    Replies: 1
    Last Post: 21st April 2009, 08:32
  5. Problem wit QTimer, different time, why?
    By perseo in forum Qt Programming
    Replies: 6
    Last Post: 8th August 2008, 09:41

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.