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. Functions in QTime
QtWS25 Last Chance

Functions in QTime

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 1.8k Views
  • 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.
  • M Offline
    M Offline
    mythili
    wrote on last edited by
    #1

    Hi,
    Is there any functions to find the differnece and sum of two QTime objects.

    Please help me

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Yes, a lot. Just read "the docs":http://qt-project.org/doc/qt-5.0/qtcore/qtime.html#msecsTo, and "more":http://qt-project.org/doc/qt-5.0/qtcore/qtime.html#secsTo. Not sure what you mean by 'sum', though.

      (Z(:^

      1 Reply Last reply
      0
      • raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #3

        you should use QDateTime for this since your caluclation may also involve days:

        Sum: "QDateTime::toTime_t()":http://qt-project.org/doc/qt-4.8/qdatetime.html#toTime_t
        Diff: "QDateTime::secsTo()":http://qt-project.org/doc/qt-4.8/qdatetime.html#secsTo

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          What are you after? Calculate a period of time?
          If so, have a look for QTimeSpan. It is not in Qt (yet), but the sources are online, and it implements substraction of two times or two dates. Not addition though, as that doesn't make any sense.

          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