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. Differentiate real time data
Qt 6.11 is out! See what's new in the release blog

Differentiate real time data

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.4k 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.
  • C Offline
    C Offline
    chandradeo
    wrote on last edited by
    #1

    Hi friends i have a simple problem. I have time information (Count Down Time) comming from the socket every one second. I want to take a difference of the current value from the previous value of seconds. eg if current value of second is 10 and previous was 9 then i want to subtract 10-9. How can i do it programatically. Please suggest. Thank u all in advance.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Keep a copy of the last value received, subtract the new and store it in place of the last one.

      There isn't much more than that

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chandradeo
        wrote on last edited by
        #3

        [quote author="SGaist" date="1390251464"]Hi,

        Keep a copy of the last value received, subtract the new and store it in place of the last one.

        There isn't much more than that

        Hope it helps[/quote]

        Hi SGaist now i am able to do .Actually i was not knowing how to keep the last one. But now i am able to do with static variable. Thank u

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          If you are using static variables for that you are probably doing it wrong.

          You don't need them for this kind of problem

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • C Offline
            C Offline
            chandradeo
            wrote on last edited by
            #5

            [quote author="SGaist" date="1390307986"]If you are using static variables for that you are probably doing it wrong.

            You don't need them for this kind of problem[/quote]

            Hi SGaist i have implemented using static variable only and it is working also.
            I am putting the last value in a static variable every time after taking the difference of current and last value. I have implemented it using timer. On every timeout of timer i read the current value and put the current value into ststic variable lastvalue. In this way my code was solving my purpose.

            If u can suggets a better and accurate solution you are most welcome and plz explain how to do that??

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              I didn't say it would not work, but you are using the wrong tool.

              A class member is better suited for that

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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