Revert wrong fix for wxDateTime timezone conversion to/from local

This reverts commit aaddf6be7f as it broke
handling of dates when local time zone is BST, whose offset not counting DST
is 0, as for UTC, but which still should be handled as local timezone,
see #17220.

With the current wxDateTime handling of time zones, FromTimezone(Local)
doesn't make much sense anyhow, so abandon attempts to try making it work as
to really do it we need to specify the time zone being converted from too, as
explained in the second point of #10445.

See #16585.
This commit is contained in:
Vadim Zeitlin
2017-04-19 16:47:36 +02:00
parent dd134b9534
commit f6d9d7962e
3 changed files with 45 additions and 13 deletions

View File

@@ -2064,11 +2064,7 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST)
// include the DST offset (as it varies depending on the date), so we have
// to handle DST manually, unless a special flag inhibiting this was
// specified.
//
// Notice that we also shouldn't add the DST offset if we're already in the
// local time zone, as indicated by offset of 0, converting from local time
// to local time zone shouldn't change it, whether DST is in effect or not.
if ( !noDST && secDiff && (IsDST() == 1) )
if ( !noDST && (IsDST() == 1) )
{
// FIXME we assume that the DST is always shifted by 1 hour
secDiff -= 3600;
@@ -2082,7 +2078,7 @@ wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST)
long secDiff = wxGetTimeZone() + tz.GetOffset();
// See comment in MakeTimezone() above, the logic here is exactly the same.
if ( !noDST && secDiff && (IsDST() == 1) )
if ( !noDST && (IsDST() == 1) )
{
// FIXME we assume that the DST is always shifted by 1 hour
secDiff -= 3600;