Use symbolic constant for DST shift
No real changes, just use DST_OFFSET constant instead of 3600 and remove the "FIXME" comments as we're not actually going to fix anything here but will just continue to assume 1 hour shift for DST.
This commit is contained in:
parent
f6d9d7962e
commit
9c35db85d1
@ -277,6 +277,15 @@ public:
|
|||||||
Sunday_First // week starts with a Sunday
|
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
|
// helper classes
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -2066,8 +2066,7 @@ wxDateTime& wxDateTime::MakeTimezone(const TimeZone& tz, bool noDST)
|
|||||||
// specified.
|
// specified.
|
||||||
if ( !noDST && (IsDST() == 1) )
|
if ( !noDST && (IsDST() == 1) )
|
||||||
{
|
{
|
||||||
// FIXME we assume that the DST is always shifted by 1 hour
|
secDiff -= DST_OFFSET;
|
||||||
secDiff -= 3600;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Add(wxTimeSpan::Seconds(secDiff));
|
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.
|
// See comment in MakeTimezone() above, the logic here is exactly the same.
|
||||||
if ( !noDST && (IsDST() == 1) )
|
if ( !noDST && (IsDST() == 1) )
|
||||||
{
|
{
|
||||||
// FIXME we assume that the DST is always shifted by 1 hour
|
secDiff -= DST_OFFSET;
|
||||||
secDiff -= 3600;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Subtract(wxTimeSpan::Seconds(secDiff));
|
return Subtract(wxTimeSpan::Seconds(secDiff));
|
||||||
|
@ -689,10 +689,7 @@ wxString wxDateTime::Format(const wxString& formatp, const TimeZone& tz) const
|
|||||||
// time in the local time zone to the user.
|
// time in the local time zone to the user.
|
||||||
if ( ofs == -wxGetTimeZone() && IsDST() == 1 )
|
if ( ofs == -wxGetTimeZone() && IsDST() == 1 )
|
||||||
{
|
{
|
||||||
// FIXME: As elsewhere in wxDateTime, we assume
|
ofs += DST_OFFSET;
|
||||||
// that the DST is always 1 hour, but this is not
|
|
||||||
// true in general.
|
|
||||||
ofs += 3600;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ofs < 0 )
|
if ( ofs < 0 )
|
||||||
|
Loading…
Reference in New Issue
Block a user