Results 1 to 4 of 4

Thread: Alternative to QElapsedTimer in old Qt version

  1. #1
    Join Date
    Jul 2009
    Posts
    74
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question Alternative to QElapsedTimer in old Qt version

    Hi,

    I would like to run some simple benchmarks on an embedded device with an architecture that does not support valgrind.
    For my purposes, something like the the QElapsedTimer would be sufficient, unfortunately, the Qt version on the device is too old, and cannot be upgraded easily.

    What would be a viable alternative to using QElapsedTimer that would work with Qt 4.6.3 ?

    Thanks!

  2. #2
    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: Alternative to QElapsedTimer in old Qt version

    You could use QTime with msecsTo().
    ==========================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.

  3. The following user says thank you to high_flyer for this useful post:

    Asperamanca (17th March 2011)

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

    Default Re: Alternative to QElapsedTimer in old Qt version

    Or with elapsed()
    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.


  5. The following user says thank you to wysota for this useful post:

    Asperamanca (17th March 2011)

  6. #4
    Join Date
    Feb 2012
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Alternative to QElapsedTimer in old Qt version

    the right pattern seems to be:

    #if (QT_VERSION < QT_VERSION_CHECK(4, 7, 0))
    # include <QTime>
    typedef QTime QElapsedTimer;
    #else
    # include <QElapsedTimer>
    #endif

Similar Threads

  1. Creating an evaluation version or trial version
    By munna in forum General Discussion
    Replies: 9
    Last Post: 20th June 2015, 01:50
  2. accepted() alternative
    By hojoff79 in forum Qt Programming
    Replies: 2
    Last Post: 19th January 2011, 02:19
  3. Replies: 0
    Last Post: 11th August 2009, 09:38
  4. Replies: 5
    Last Post: 5th October 2008, 05:12
  5. alternative to COM??
    By TheKedge in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2006, 15:02

Tags for this Thread

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.