summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@digia.com>2013-09-16 11:55:07 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-19 14:58:27 +0200
commit438912f27350cfe5f63f8abc68f4fc99614ee7c5 (patch)
treed03681ece7a2e4fbfec4a71f5ec0e9d1ac2b7052
parent89294d04e2e417289198762211bd5f789c3eefc6 (diff)
Revert 15da0a5af20fe6771bcb94ef8d46edbd5c8fb64c.
It apparently breaks users' applications. Task-number: QTBUG-33487 Change-Id: Iaeceb3a02b5c7b9ab839c14693aaffcdf9394bc6 Reviewed-by: John Layt <jlayt@kde.org> Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r--src/corelib/tools/qdatetime.cpp29
-rw-r--r--tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp4
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp21
-rw-r--r--tests/auto/corelib/tools/qtime/tst_qtime.cpp16
4 files changed, 33 insertions, 37 deletions
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index dac1455d5c..ff96fbf811 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1583,12 +1583,12 @@ int QTime::msec() const
Returns the time as a string. The \a format parameter determines
the format of the string.
- If \a format is Qt::TextDate, the string format is HH:MM:SS.zzz;
- e.g. 1 second before midnight would be "23:59:59.000".
+ If \a format is Qt::TextDate, the string format is HH:MM:SS;
+ e.g. 1 second before midnight would be "23:59:59".
If \a format is Qt::ISODate, the string format corresponds to the
- ISO 8601 extended specification (with decimal fractions) for
- representations of dates; also HH:MM:SS.zzz.
+ ISO 8601 extended specification for representations of dates,
+ which is also HH:MM:SS.
If the \a format is Qt::SystemLocaleShortDate or
Qt::SystemLocaleLongDate, the string format depends on the locale
@@ -1636,10 +1636,9 @@ QString QTime::toString(Qt::DateFormat format) const
case Qt::ISODate:
case Qt::TextDate:
default:
- return QString::fromUtf8("%1:%2:%3.%4").arg(hour(), 2, 10, QLatin1Char('0'))
- .arg(minute(), 2, 10, QLatin1Char('0'))
- .arg(second(), 2, 10, QLatin1Char('0'))
- .arg(msec(), 3, 10, QLatin1Char('0'));
+ return QString::fromUtf8("%1:%2:%3").arg(hour(), 2, 10, QLatin1Char('0'))
+ .arg(minute(), 2, 10, QLatin1Char('0'))
+ .arg(second(), 2, 10, QLatin1Char('0'));
}
}
@@ -2729,15 +2728,15 @@ void QDateTime::setTime_t(uint secsSince1Jan1970UTC)
and QTime::toString() are used to generate the string, so the
day and month names will be localized names using the system locale,
i.e. QLocale::system(). An example of this formatting is
- "Wed May 20 03:40:13.456 1998".
+ "Wed May 20 03:40:13 1998".
If the \a format is Qt::ISODate, the string format corresponds
- to the ISO 8601 extended specification (with decimal fractions) for
- representations of dates and times, taking the form
- YYYY-MM-DDTHH:MM:SS.zzz[Z|[+|-]HH:MM], depending on the timeSpec()
- of the QDateTime. If the timeSpec() is Qt::UTC, Z will be appended
- to the string; if the timeSpec() is Qt::OffsetFromUTC, the offset
- in hours and minutes from UTC will be appended to the string.
+ to the ISO 8601 extended specification for representations of
+ dates and times, taking the form YYYY-MM-DDTHH:MM:SS[Z|[+|-]HH:MM],
+ depending on the timeSpec() of the QDateTime. If the timeSpec()
+ is Qt::UTC, Z will be appended to the string; if the timeSpec() is
+ Qt::OffsetFromUTC, the offset in hours and minutes from UTC will
+ be appended to the string.
If the \a format is Qt::SystemLocaleShortDate or
Qt::SystemLocaleLongDate, the string format depends on the locale
diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
index 6366c47601..422bd63163 100644
--- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
+++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp
@@ -995,8 +995,8 @@ void tst_QVariant::toString_data()
QTest::newRow( "float" ) << QVariant( 123.456f ) << QString( "123.456" );
QTest::newRow( "bool" ) << QVariant( true ) << QString( "true" );
QTest::newRow( "qdate" ) << QVariant( QDate( 2002, 1, 1 ) ) << QString( "2002-01-01" );
- QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56.000" );
- QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 1, 1 ), QTime( 12, 34, 56 ) ) ) << QString( "2002-01-01T12:34:56.000" );
+ QTest::newRow( "qtime" ) << QVariant( QTime( 12, 34, 56 ) ) << QString( "12:34:56" );
+ QTest::newRow( "qdatetime" ) << QVariant( QDateTime( QDate( 2002, 1, 1 ), QTime( 12, 34, 56 ) ) ) << QString( "2002-01-01T12:34:56" );
QTest::newRow( "llong" ) << QVariant( (qlonglong)Q_INT64_C(123456789012) ) <<
QString( "123456789012" );
QTest::newRow("QJsonValue") << QVariant(QJsonValue(QString("hello"))) << QString("hello");
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index 85bc8abc52..cfc3a32bf5 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -631,25 +631,22 @@ void tst_QDateTime::toString_isoDate_data()
QTest::newRow("localtime")
<< QDateTime(QDate(1978, 11, 9), QTime(13, 28, 34))
- << QString("1978-11-09T13:28:34.000");
+ << QString("1978-11-09T13:28:34");
QTest::newRow("UTC")
<< QDateTime(QDate(1978, 11, 9), QTime(13, 28, 34), Qt::UTC)
- << QString("1978-11-09T13:28:34.000Z");
+ << QString("1978-11-09T13:28:34Z");
QDateTime dt(QDate(1978, 11, 9), QTime(13, 28, 34));
dt.setOffsetFromUtc(19800);
QTest::newRow("positive OffsetFromUTC")
<< dt
- << QString("1978-11-09T13:28:34.000+05:30");
+ << QString("1978-11-09T13:28:34+05:30");
dt.setUtcOffset(-7200);
QTest::newRow("negative OffsetFromUTC")
<< dt
- << QString("1978-11-09T13:28:34.000-02:00");
+ << QString("1978-11-09T13:28:34-02:00");
QTest::newRow("invalid")
<< QDateTime(QDate(-1, 11, 9), QTime(13, 28, 34), Qt::UTC)
<< QString();
- QTest::newRow("999 milliseconds UTC")
- << QDateTime(QDate(2000, 1, 1), QTime(13, 28, 34, 999), Qt::UTC)
- << QString("2000-01-01T13:28:34.999Z");
}
void tst_QDateTime::toString_isoDate()
@@ -684,15 +681,15 @@ void tst_QDateTime::toString_textDate_data()
QTest::addColumn<QString>("expected");
QTest::newRow("localtime") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::LocalTime)
- << QString("Wed Jan 2 01:02:03.000 2013");
+ << QString("Wed Jan 2 01:02:03 2013");
QTest::newRow("utc") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::UTC)
- << QString("Wed Jan 2 01:02:03.000 2013 GMT");
+ << QString("Wed Jan 2 01:02:03 2013 GMT");
QTest::newRow("offset+") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::OffsetFromUTC,
10 * 60 * 60)
- << QString("Wed Jan 2 01:02:03.000 2013 GMT+1000");
+ << QString("Wed Jan 2 01:02:03 2013 GMT+1000");
QTest::newRow("offset-") << QDateTime(QDate(2013, 1, 2), QTime(1, 2, 3), Qt::OffsetFromUTC,
-10 * 60 * 60)
- << QString("Wed Jan 2 01:02:03.000 2013 GMT-1000");
+ << QString("Wed Jan 2 01:02:03 2013 GMT-1000");
QTest::newRow("invalid") << QDateTime()
<< QString("");
}
@@ -765,7 +762,7 @@ void tst_QDateTime::toString_enumformat()
QVERIFY(!str1.isEmpty()); // It's locale dependent everywhere
QString str2 = dt1.toString(Qt::ISODate);
- QCOMPARE(str2, QString("1995-05-20T12:34:56.000"));
+ QCOMPARE(str2, QString("1995-05-20T12:34:56"));
QString str3 = dt1.toString(Qt::LocalDate);
QVERIFY(!str3.isEmpty());
diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
index 3941794202..0563111abb 100644
--- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp
+++ b/tests/auto/corelib/tools/qtime/tst_qtime.cpp
@@ -677,14 +677,14 @@ void tst_QTime::toStringDateFormat_data()
QTest::addColumn<Qt::DateFormat>("format");
QTest::addColumn<QString>("expected");
- QTest::newRow("00:00:00.000") << QTime(0, 0, 0, 0) << Qt::TextDate << QString("00:00:00.000");
- QTest::newRow("ISO 00:00:00.000") << QTime(0, 0, 0, 0) << Qt::ISODate << QString("00:00:00.000");
- QTest::newRow("Text 10:12:34.000") << QTime(10, 12, 34, 0) << Qt::TextDate << QString("10:12:34.000");
- QTest::newRow("ISO 10:12:34.000") << QTime(10, 12, 34, 0) << Qt::ISODate << QString("10:12:34.000");
- QTest::newRow("Text 10:12:34.001") << QTime(10, 12, 34, 001) << Qt::TextDate << QString("10:12:34.001");
- QTest::newRow("ISO 10:12:34.001") << QTime(10, 12, 34, 001) << Qt::ISODate << QString("10:12:34.001");
- QTest::newRow("Text 10:12:34.999") << QTime(10, 12, 34, 999) << Qt::TextDate << QString("10:12:34.999");
- QTest::newRow("ISO 10:12:34.999") << QTime(10, 12, 34, 999) << Qt::ISODate << QString("10:12:34.999");
+ QTest::newRow("00:00:00.000") << QTime(0, 0, 0, 0) << Qt::TextDate << QString("00:00:00");
+ QTest::newRow("ISO 00:00:00.000") << QTime(0, 0, 0, 0) << Qt::ISODate << QString("00:00:00");
+ QTest::newRow("Text 10:12:34.000") << QTime(10, 12, 34, 0) << Qt::TextDate << QString("10:12:34");
+ QTest::newRow("ISO 10:12:34.000") << QTime(10, 12, 34, 0) << Qt::ISODate << QString("10:12:34");
+ QTest::newRow("Text 10:12:34.001") << QTime(10, 12, 34, 001) << Qt::TextDate << QString("10:12:34");
+ QTest::newRow("ISO 10:12:34.001") << QTime(10, 12, 34, 001) << Qt::ISODate << QString("10:12:34");
+ QTest::newRow("Text 10:12:34.999") << QTime(10, 12, 34, 999) << Qt::TextDate << QString("10:12:34");
+ QTest::newRow("ISO 10:12:34.999") << QTime(10, 12, 34, 999) << Qt::ISODate << QString("10:12:34");
QTest::newRow("RFC2822Date") << QTime(10, 12, 34, 999) << Qt::RFC2822Date << QString("10:12:34");
}