Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. High-resolution timer
Forum Updated to NodeBB v4.3 + New Features

High-resolution timer

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AntonZelenin
    wrote on last edited by AntonZelenin
    #1

    Hello. I have such a problem: I need to measure time precisely, acceptable inaccuracy is about 1-2 msec. I use Qt SDK 1.1 on Windows XP. I tried QTimer, clock(), chrono, I also tried to increase application priority to Real time but inaccuracy always is 5 msec (or 15, I'm not sure about it). Could anybody please tell me what's the problem and how to deal with it?

    kshegunovK 1 Reply Last reply
    0
    • A AntonZelenin

      Hello. I have such a problem: I need to measure time precisely, acceptable inaccuracy is about 1-2 msec. I use Qt SDK 1.1 on Windows XP. I tried QTimer, clock(), chrono, I also tried to increase application priority to Real time but inaccuracy always is 5 msec (or 15, I'm not sure about it). Could anybody please tell me what's the problem and how to deal with it?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #2

      @AntonZelenin
      Hello,
      Did you try setting the timer type? If the OS has a precise timer you should be able to get about that accuracy.

      I also tried to increase application priority to Real time

      This is irrelevant in this particular case.

      PS.

      I need to measure time precisely

      If you only need to measure the time between two points in your code, then you can use QElapsedTimer.

      Kind regards.

      Read and abide by the Qt Code of Conduct

      A 1 Reply Last reply
      1
      • kshegunovK kshegunov

        @AntonZelenin
        Hello,
        Did you try setting the timer type? If the OS has a precise timer you should be able to get about that accuracy.

        I also tried to increase application priority to Real time

        This is irrelevant in this particular case.

        PS.

        I need to measure time precisely

        If you only need to measure the time between two points in your code, then you can use QElapsedTimer.

        Kind regards.

        A Offline
        A Offline
        AntonZelenin
        wrote on last edited by
        #3

        @kshegunov
        My version of Qt appears not to have timer types. And QElapsedTimer gave me only 10 msec accuracy=(

        kshegunovK 1 Reply Last reply
        1
        • A AntonZelenin

          @kshegunov
          My version of Qt appears not to have timer types. And QElapsedTimer gave me only 10 msec accuracy=(

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #4

          @AntonZelenin
          Are you perchance using Qt 4, as the timer types are introduced in Qt 5?
          If that's so (which is very probable) I advise to switch to Qt 5. Qt 4 has been marked not advised for new development.

          And QElapsedTimer gave me only 10 msec accuracy

          This would ultimately depend on the accuracy the OS can provide.

          Kind regards.

          Read and abide by the Qt Code of Conduct

          A 1 Reply Last reply
          0
          • kshegunovK kshegunov

            @AntonZelenin
            Are you perchance using Qt 4, as the timer types are introduced in Qt 5?
            If that's so (which is very probable) I advise to switch to Qt 5. Qt 4 has been marked not advised for new development.

            And QElapsedTimer gave me only 10 msec accuracy

            This would ultimately depend on the accuracy the OS can provide.

            Kind regards.

            A Offline
            A Offline
            AntonZelenin
            wrote on last edited by AntonZelenin
            #5

            @kshegunov
            If I switch to Qt5, I'll have to change some my code... And if I switch to Qt5, will my app still be compatible with Windows XP?

            kshegunovK 1 Reply Last reply
            0
            • A AntonZelenin

              @kshegunov
              If I switch to Qt5, I'll have to change some my code... And if I switch to Qt5, will my app still be compatible with Windows XP?

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by kshegunov
              #6

              @AntonZelenin

              If I switch to Qt5, I'll have to change big enough amount of my code...

              I sympathize, but bear in mind Qt 4 is pretty old now (even the latest version).

              And if I switch to Qt5, will my app still be compatible with Windows XP?

              I don't know, sorry. Perhaps some of our Windows users will pitch in and say if Qt 5 works fine on win XP.

              Read and abide by the Qt Code of Conduct

              Joel BodenmannJ 1 Reply Last reply
              1
              • kshegunovK kshegunov

                @AntonZelenin

                If I switch to Qt5, I'll have to change big enough amount of my code...

                I sympathize, but bear in mind Qt 4 is pretty old now (even the latest version).

                And if I switch to Qt5, will my app still be compatible with Windows XP?

                I don't know, sorry. Perhaps some of our Windows users will pitch in and say if Qt 5 works fine on win XP.

                Joel BodenmannJ Offline
                Joel BodenmannJ Offline
                Joel Bodenmann
                wrote on last edited by Joel Bodenmann
                #7

                I have a Qt application that was build with Qt 5.6 and sadly (or to my surprise) I know of nearly a dozen users that use it on Windows XP without any issues.
                Of course this might depend on the features and modules that you are using. So just to be sure: I am not saying you that your application will definitely work on Windows XP if you move to Qt 5. I'm just saying that my application(s) appear to work for Windows XP users.

                Edit: For more information you might want to check out this: https://doc.qt.io/qt-5/supported-platforms.html

                Industrial process automation software: https://simulton.com
                Embedded Graphics & GUI library: https://ugfx.io

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  AntonZelenin
                  wrote on last edited by AntonZelenin
                  #8

                  Okay, thank you both. I'll try to use Qt5=)
                  Should I mark this topic as Solved now?

                  kshegunovK 1 Reply Last reply
                  0
                  • A AntonZelenin

                    Okay, thank you both. I'll try to use Qt5=)
                    Should I mark this topic as Solved now?

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #9

                    @AntonZelenin

                    Okay, thank you both. I'll try to use Qt5=)

                    No problem and good luck!

                    Should I mark this question as Solved now?

                    If you're satisfied with the answers please do.
                    (Someone might add something later irrespective of the topic being marked as solved, it's only a marker of sorts)

                    Read and abide by the Qt Code of Conduct

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved