diff options
author | John Layt <jlayt@kde.org> | 2013-08-13 14:17:08 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-13 22:06:26 +0200 |
commit | 92b0a7fa3ee874bc4a9a39da112896fa7e3a97e9 (patch) | |
tree | 180907eca0248aed0b3fe44c238a96c56978cd4a /src/corelib/tools/qdatetime.h | |
parent | 63a382a93073a96457a41118753ae88547023cac (diff) |
QTime - Add public api for get/set msecs since start of day
Add new public api to get and set the number of msecs since the start
of the day. Modify QDateTime to use the new msecs api.
[ChangeLog][QtCore][QTime] Added new methods fromMSecsSinceStartOfDay()
to create a new QTime from an msecs value, and msecsSinceStartOfDay()
to return the QTime as the number of msecs since the start of the day.
Change-Id: I285b725b883f1f5524fda87ca81bd64ed99fe6f4
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src/corelib/tools/qdatetime.h')
-rw-r--r-- | src/corelib/tools/qdatetime.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 8b63c5a377..779aae5b5b 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -168,6 +168,9 @@ public: bool operator>(const QTime &other) const { return mds > other.mds; } bool operator>=(const QTime &other) const { return mds >= other.mds; } + static inline QTime fromMSecsSinceStartOfDay(int msecs) { QTime t; t.mds = msecs; return t; } + inline int msecsSinceStartOfDay() const { return mds == NullTime ? 0 : mds; } + static QTime currentTime(); #ifndef QT_NO_DATESTRING static QTime fromString(const QString &s, Qt::DateFormat f = Qt::TextDate); |