Functions in QTime
-
Hi,
Is there any functions to find the differnece and sum of two QTime objects.Please help me
-
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.
-
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 -
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.