diff --git a/include/wx/datetime.h b/include/wx/datetime.h index 194c1f4d79..b2a33ffd9a 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -277,6 +277,15 @@ public: Sunday_First // week starts with a Sunday }; + // Currently we assume that DST is always shifted by 1 hour, this seems to + // be always true in practice. If this ever needs to change, search for all + // places using DST_OFFSET and update them. + enum + { + DST_OFFSET = 3600 + }; + + // helper classes // ------------------------------------------------------------------------ diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index a1ef82772b..eddaf7977e 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -2066,8 +2066,7 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST) // specified. if ( !noDST && (IsDST() == 1) ) { - // FIXME we assume that the DST is always shifted by 1 hour - secDiff -= 3600; + secDiff -= DST_OFFSET; } return Add(wxTimeSpan::Seconds(secDiff)); @@ -2080,8 +2079,7 @@ wxDateTime& wxDateTime::MakeFromTimezone(const TimeZone& tz, bool noDST) // See comment in MakeTimezone() above, the logic here is exactly the same. if ( !noDST && (IsDST() == 1) ) { - // FIXME we assume that the DST is always shifted by 1 hour - secDiff -= 3600; + secDiff -= DST_OFFSET; } return Subtract(wxTimeSpan::Seconds(secDiff)); diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index 8fbf1e0034..86aca9f32f 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -689,10 +689,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const // time in the local time zone to the user. if ( ofs == -wxGetTimeZone() && IsDST() == 1 ) { - // FIXME: As elsewhere in wxDateTime, we assume - // that the DST is always 1 hour, but this is not - // true in general. - ofs += 3600; + ofs += DST_OFFSET; } if ( ofs < 0 )