summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qdatetime.h
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2013-03-01 16:36:31 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-29 00:32:08 +0200
commitad77048d1f85c75b93b154c3aec67f6822188db5 (patch)
tree366dfeb80319c20d9c544ee170e49d1f738b15db /src/corelib/tools/qdatetime.h
parent13c16bbd06e0034210ba2164f1be208c49a6e3a7 (diff)
QDateTime - Extend fromMSecsSinceEpoch API
Add convenience methods for fromMSecsSinceEpoch() and fromTime_t() to enable direct creation of other time specs than LocalTime without the overhead of unncessary conversions. For example instead of: QDateTime dt = fromMSecsSinceEpoch(12345).toUtc(); the following saves two conversions: QDateTime dt = fromMSecsSinceEpoch(12345, Qt:UTC); This will improve the performance of the new QTimeZone class. [ChangeLog][QtCore][QDateTime] Added convenience methods for fromMSecsSinceEpoch() and fromTime_t() to take time spec to be used in returned datetime. Change-Id: I133635bfe3d35ee496a287257e13b2d600225a38 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Mitch Curtis <mitch.curtis@digia.com>
Diffstat (limited to 'src/corelib/tools/qdatetime.h')
-rw-r--r--src/corelib/tools/qdatetime.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h
index 83c92858ee..3c8b1a9920 100644
--- a/src/corelib/tools/qdatetime.h
+++ b/src/corelib/tools/qdatetime.h
@@ -271,7 +271,12 @@ public:
#endif
// ### Qt 6: use quint64 instead of uint
static QDateTime fromTime_t(uint secsSince1Jan1970UTC);
+ // ### Qt 6: Merge with above with default spec = Qt::LocalTime
+ static QDateTime fromTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec,
+ int offsetFromUtc = 0);
static QDateTime fromMSecsSinceEpoch(qint64 msecs);
+ // ### Qt 6: Merge with above with default spec = Qt::LocalTime
+ static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec, int offsetFromUtc = 0);
static qint64 currentMSecsSinceEpoch() Q_DECL_NOTHROW;
private: