diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-03-30 08:40:25 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-03-31 10:41:00 (GMT) |
commit | 32f002486941c0cba246e08491e9a0800942cded (patch) | |
tree | 1cae010bd4442ce344064c8ad896a4408d688519 | |
parent | 582cbf2d92addb34088830a3de97c08ddb147e30 (diff) | |
download | Qt-32f002486941c0cba246e08491e9a0800942cded.zip Qt-32f002486941c0cba246e08491e9a0800942cded.tar.gz Qt-32f002486941c0cba246e08491e9a0800942cded.tar.bz2 |
Rename the xxxMsecsSinceEpoch functions to xxxMSecsSinceEpoch.
Matches the addMSecs existing functions in QTime and QDateTime.
Reviewed-by: Marius Storm-Olsen
-rw-r--r-- | src/corelib/tools/qdatetime.cpp | 32 | ||||
-rw-r--r-- | src/corelib/tools/qdatetime.h | 8 | ||||
-rw-r--r-- | src/corelib/tools/qelapsedtimer_generic.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qdatetime/tst_qdatetime.cpp | 18 |
4 files changed, 31 insertions, 31 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 7628dd2..69b232d 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -2315,7 +2315,7 @@ void QDateTime::setTimeSpec(Qt::TimeSpec spec) } } -qint64 toMsecsSinceEpoch_helper(qint64 jd, int msecs) +qint64 toMSecsSinceEpoch_helper(qint64 jd, int msecs) { int days = jd - julianDayFromGregorianDate(1970, 1, 1); qint64 retval = (qlonglong(days) * MSECS_PER_DAY) + msecs; @@ -2335,15 +2335,15 @@ qint64 toMsecsSinceEpoch_helper(qint64 jd, int msecs) this object is not valid. However, for all valid dates, this function returns a unique value. - \sa toTime_t(), setMsecsSinceEpoch() + \sa toTime_t(), setMSecsSinceEpoch() */ -qint64 QDateTime::toMsecsSinceEpoch() const +qint64 QDateTime::toMSecsSinceEpoch() const { QDate utcDate; QTime utcTime; d->getUTC(utcDate, utcTime); - return toMsecsSinceEpoch_helper(utcDate.jd, utcTime.ds()); + return toMSecsSinceEpoch_helper(utcDate.jd, utcTime.ds()); } /*! @@ -2363,14 +2363,14 @@ qint64 QDateTime::toMsecsSinceEpoch() const 2106-02-07T06:28:14, this function returns -1 cast to an unsigned integer (i.e., 0xFFFFFFFF). - To get an extended range, use toMsecsSinceEpoch(). + To get an extended range, use toMSecsSinceEpoch(). - \sa toMsecsSinceEpoch(), setTime_t() + \sa toMSecsSinceEpoch(), setTime_t() */ uint QDateTime::toTime_t() const { - qint64 retval = toMsecsSinceEpoch() / 1000; + qint64 retval = toMSecsSinceEpoch() / 1000; if (quint64(retval) >= Q_UINT64_C(0xFFFFFFFF)) return uint(-1); return uint(retval); @@ -2388,9 +2388,9 @@ uint QDateTime::toTime_t() const valid range of QDateTime, both negative and positive. The behavior of this function is undefined for those values. - \sa toMsecsSinceEpoch(), setTime_t() + \sa toMSecsSinceEpoch(), setTime_t() */ -void QDateTime::setMsecsSinceEpoch(qint64 msecs) +void QDateTime::setMSecsSinceEpoch(qint64 msecs) { detach(); @@ -2878,7 +2878,7 @@ bool QDateTime::operator<(const QDateTime &other) const */ /*! - \fn qint64 QDateTime::currentMsecsSinceEpoch() + \fn qint64 QDateTime::currentMSecsSinceEpoch() \since 4.7 Returns the number of milliseconds since 1970-01-01T00:00:00 Universal @@ -2941,7 +2941,7 @@ QDateTime QDateTime::currentDateTimeUtc() return QDateTime(d, t, Qt::UTC); } -qint64 QDateTime::currentMsecsSinceEpoch() +qint64 QDateTime::currentMSecsSinceEpoch() { QDate d; QTime t; @@ -3005,7 +3005,7 @@ QDateTime QDateTime::currentDateTimeUtc() return QDateTime(d, ct, Qt::UTC); } -qint64 QDateTime::currentMsecsSinceEpoch() +qint64 QDateTime::currentMSecsSinceEpoch() { QDate d; QTime ct; @@ -3122,7 +3122,7 @@ QDateTime QDateTime::currentDateTimeUtc() return dt; } -qint64 QDateTime::currentMsecsSinceEpoch() +qint64 QDateTime::currentMSecsSinceEpoch() { // posix compliant system // we have milliseconds @@ -3166,10 +3166,10 @@ QDateTime QDateTime::fromTime_t(uint seconds) \sa toTime_t(), setTime_t() */ -QDateTime QDateTime::fromMsecsSinceEpoch(qint64 msecs) +QDateTime QDateTime::fromMSecsSinceEpoch(qint64 msecs) { QDateTime d; - d.setMsecsSinceEpoch(msecs); + d.setMSecsSinceEpoch(msecs); return d; } @@ -3928,7 +3928,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) QDate fakeDate = adjustDate(date); // won't overflow because of fakeDate - time_t secsSince1Jan1970UTC = toMsecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000; + time_t secsSince1Jan1970UTC = toMSecsSinceEpoch_helper(fakeDate.toJulianDay(), QTime().msecsTo(time)) / 1000; tm *brokenDown = 0; #if defined(Q_OS_WINCE) diff --git a/src/corelib/tools/qdatetime.h b/src/corelib/tools/qdatetime.h index 248793b..f445f1c 100644 --- a/src/corelib/tools/qdatetime.h +++ b/src/corelib/tools/qdatetime.h @@ -230,12 +230,12 @@ public: QDate date() const; QTime time() const; Qt::TimeSpec timeSpec() const; - qint64 toMsecsSinceEpoch() const; + qint64 toMSecsSinceEpoch() const; uint toTime_t() const; void setDate(const QDate &date); void setTime(const QTime &time); void setTimeSpec(Qt::TimeSpec spec); - void setMsecsSinceEpoch(qint64 msecs); + void setMSecsSinceEpoch(qint64 msecs); void setTime_t(uint secsSince1Jan1970UTC); #ifndef QT_NO_DATESTRING QString toString(Qt::DateFormat f = Qt::TextDate) const; @@ -269,8 +269,8 @@ public: static QDateTime fromString(const QString &s, const QString &format); #endif static QDateTime fromTime_t(uint secsSince1Jan1970UTC); - static QDateTime fromMsecsSinceEpoch(qint64 msecs); - static qint64 currentMsecsSinceEpoch(); + static QDateTime fromMSecsSinceEpoch(qint64 msecs); + static qint64 currentMSecsSinceEpoch(); #ifdef QT3_SUPPORT inline QT3_SUPPORT void setTime_t(uint secsSince1Jan1970UTC, Qt::TimeSpec spec) { diff --git a/src/corelib/tools/qelapsedtimer_generic.cpp b/src/corelib/tools/qelapsedtimer_generic.cpp index 9b589c1..85986e6 100644 --- a/src/corelib/tools/qelapsedtimer_generic.cpp +++ b/src/corelib/tools/qelapsedtimer_generic.cpp @@ -98,7 +98,7 @@ void QElapsedTimer::start() qint64 QElapsedTimer::restart() { qint64 old = t1; - t1 = QDateTime::currentMsecsSinceEpoch(); + t1 = QDateTime::currentMSecsSinceEpoch(); t2 = 0; return t1 - old; } @@ -112,7 +112,7 @@ qint64 QElapsedTimer::restart() */ qint64 QElapsedTimer::elapsed() const { - return QDateTime::currentMsecsSinceEpoch() - t1; + return QDateTime::currentMSecsSinceEpoch() - t1; } /*! diff --git a/tests/auto/qdatetime/tst_qdatetime.cpp b/tests/auto/qdatetime/tst_qdatetime.cpp index b04a1b5..6aca996 100644 --- a/tests/auto/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/qdatetime/tst_qdatetime.cpp @@ -83,8 +83,8 @@ private slots: void setTime(); void setTimeSpec(); void setTime_t(); - void setMsecsSinceEpoch_data(); - void setMsecsSinceEpoch(); + void setMSecsSinceEpoch_data(); + void setMSecsSinceEpoch(); void toString_enumformat(); void toString_strformat_data(); void toString_strformat(); @@ -439,7 +439,7 @@ void tst_QDateTime::setTime_t() } } -void tst_QDateTime::setMsecsSinceEpoch_data() +void tst_QDateTime::setMSecsSinceEpoch_data() { QTest::addColumn<qint64>("msecs"); QTest::addColumn<QDateTime>("utc"); @@ -479,7 +479,7 @@ void tst_QDateTime::setMsecsSinceEpoch_data() << QDateTime(QDate::fromJulianDay(0x7fffffff), QTime(23, 59, 59, 999)); } -void tst_QDateTime::setMsecsSinceEpoch() +void tst_QDateTime::setMSecsSinceEpoch() { QFETCH(qint64, msecs); QFETCH(QDateTime, utc); @@ -487,14 +487,14 @@ void tst_QDateTime::setMsecsSinceEpoch() QDateTime dt; dt.setTimeSpec(Qt::UTC); - dt.setMsecsSinceEpoch(msecs); + dt.setMSecsSinceEpoch(msecs); QCOMPARE(dt, utc); if (europeanTimeZone) { QCOMPARE(dt.toLocalTime(), european); } - QCOMPARE(dt.toMsecsSinceEpoch(), msecs); + QCOMPARE(dt.toMSecsSinceEpoch(), msecs); if (quint64(msecs / 1000) < 0xFFFFFFFF) { QCOMPARE(qint64(dt.toTime_t()), msecs / 1000); @@ -999,7 +999,7 @@ void tst_QDateTime::currentDateTimeUtc2() do { local = QDateTime::currentDateTime(); utc = QDateTime::currentDateTimeUtc(); - msec = QDateTime::currentMsecsSinceEpoch(); + msec = QDateTime::currentMSecsSinceEpoch(); ok = local.time().msec() == utc.time().msec() && utc.time().msec() == (msec % 1000); } while (--i && !ok); @@ -1020,8 +1020,8 @@ void tst_QDateTime::currentDateTimeUtc2() // and finally, the time_t should equal our number QCOMPARE(qint64(utc.toTime_t()), msec / 1000); QCOMPARE(qint64(local.toTime_t()), msec / 1000); - QCOMPARE(utc.toMsecsSinceEpoch(), msec); - QCOMPARE(local.toMsecsSinceEpoch(), msec); + QCOMPARE(utc.toMSecsSinceEpoch(), msec); + QCOMPARE(local.toMSecsSinceEpoch(), msec); } void tst_QDateTime::toTime_t_data() |