From b05875c9771a1f3ec4e07bba56f74e85433ed4b8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 25 Mar 2012 23:17:04 +0000 Subject: [PATCH] Fix generic wxTimePickerCtrl on DST change dates. Do not use the date when DST changes as the date part of wxDateTime object used by wxTimePickerGeneric internally as this introduces problems with times that can't be represented at all -- and so can't be entered into the control. Use arbitrary date on which DST does not change to avoid this. Closes #14137. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/timectrlg.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/generic/timectrlg.cpp b/src/generic/timectrlg.cpp index b3d0e5acaf..6a5d13c6cf 100644 --- a/src/generic/timectrlg.cpp +++ b/src/generic/timectrlg.cpp @@ -131,6 +131,17 @@ public: { m_time = time.IsValid() ? time : wxDateTime::Now(); + // Ensure that the date part doesn't correspond to a DST change date as + // time is discontinuous then resulting in many problems, e.g. it's + // impossible to even enter 2:00:00 at the beginning of summer time + // date as this time doesn't exist. By using Jan 1, on which nobody + // changes DST, we avoid all such problems. + wxDateTime::Tm tm = m_time.GetTm(); + tm.mday = + tm.yday = 1; + tm.mon = wxDateTime::Jan; + m_time.Set(tm); + UpdateTextWithoutEvent(); } -- 2.45.2