diff options
author | John Layt <jlayt@kde.org> | 2013-08-19 16:50:54 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-20 23:45:06 +0200 |
commit | 7b07c3ff781c9fcdaf7a60aabed9b7aa57e25006 (patch) | |
tree | 6bcf141cb1d0e97234746a131fc1335a38eb43f4 /src/dbus/qdbusargument.cpp | |
parent | 18322bfabc3c349040bb370167e2642dc734bd50 (diff) |
QDateTime - Fix Daylight Transition for "missing" hour
When Daylight Time transtion goes from Standard Time to Daylight Time
there is a "missing" hour, i.e. at 2am CET the clock goes forward to
3am. Currently QDateTime ignores this gap and considers the time to be
valid and able to be manipulated. This change respects the transition,
so any time set in the missing hour is considered invalid, and any date
maths returns valid results.
The validity in the current time zone needs to be checked every time
isValid() is called in case the system time zone has changed since the
last time it was checked. This is done by calling mktime to check the
returned result matches the expected result. This could be very
inefficient, but the returned offset value is cached each time so
mktime is not required to be called again within each method call,
effectively meaning mktime is called the same number of times by
each method. Note that this means any new methods added must be
careful to ensure either isValid() or refreshLocalTime() is called
first by any method needing to use the UTC value.
[ChangeLog][QtCore][QDateTime] The Standard Time to Daylight Time
transition for Qt::LocalTime is now handled correctly. Any date set
in the "missing" hour is now considered invalid. All date math results
that fall into the missing hour will be automatically adjusted to a
valid time in the following hour.
Change-Id: Ia652c8511b45df15f4917acf12403ec01a7f08e7
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/dbus/qdbusargument.cpp')
0 files changed, 0 insertions, 0 deletions