qt5base-lts/tests/auto/corelib/time
Edward Welbourne e5dc46d966 Allow millisecond-overflow when the result remains valid
Even before adding support for fractional hours, a fraction of a
minute might potentially have represented a whole number of seconds by
a fractional part that, due to rounding, was less than the whole
number of seconds by less than half a millisecond. Previously, the
parsing would have clipped the fractional part at 999 milliseconds, in
the preceding second, instead of correctly rounding it up to the whole
second.

For QTime::fromString(), which can't represent 24:00, and for
TextDate, which doesn't allow 24:00 as a synomym for the next day's
0:0, applying such rounding to 23:59:59.999999 would produce an
invalid result from a string that does represent a valid time, so use
the nearest representable time, as previously.

Added some tests and amended others.

[ChangeLog][QtCore][QDateTime] QDateTime and QTime, in fromString()
with format ISODate or TextDate, now allow a fractional part of the
hour, minute or seconds to round up to the next second (hence
potentially into the next minute, etc.) when this is the closest
representable value to the exact fractional part given. When rounding
up would turn a valid result into an invalid one, however, the old
behavior of clipping to 999 milliseconds is retained.

Change-Id: I8104848d246cdb4545a12819fb4b6755da2b1372
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
2020-10-07 13:58:33 +00:00
..
qcalendar CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
qdate Add unit test to check emoji handling in date-time parsing 2020-09-23 16:59:07 +02:00
qdatetime Allow millisecond-overflow when the result remains valid 2020-10-07 13:58:33 +00:00
qtime Allow millisecond-overflow when the result remains valid 2020-10-07 13:58:33 +00:00
qtimezone CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
CMakeLists.txt Update tests/auto/corelib/time/'s CMake config 2020-07-02 15:35:17 +02:00
time.pro Make qtbase compile without QT_CONFIG(timezone) 2020-05-11 14:42:00 +03:00