Correctly detect DST in UK during 1969-1971 BST-only period
Take into account that from 1968-10-27 and until 1971-10-31 UK used BST time instead of GMT, i.e. that DST was permanently on. This fixes unit test failures in BST time zone for the dates around the Unix epoch of 1970-01-01. See #15370.
This commit is contained in:
@@ -2081,11 +2081,29 @@ int wxDateTime::IsDST(wxDateTime::Country country) const
|
|||||||
{
|
{
|
||||||
int year = GetYear();
|
int year = GetYear();
|
||||||
|
|
||||||
|
country = GetCountry();
|
||||||
|
switch ( country )
|
||||||
|
{
|
||||||
|
case UK:
|
||||||
|
// There is a special, but important, case of UK which was
|
||||||
|
// permanently on BST, i.e. using DST, during this period. It
|
||||||
|
// is important because it covers Unix epoch and without
|
||||||
|
// accounting for the DST during it, various tests done around
|
||||||
|
// the epoch time would fail in BST time zone (only!).
|
||||||
|
if ( IsEarlierThan(wxDateTime(31, Oct, 1971)) &&
|
||||||
|
IsLaterThan(wxDateTime(27, Oct, 1968)) )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
wxFALLTHROUGH;
|
||||||
|
|
||||||
|
default:
|
||||||
if ( !IsDSTApplicable(year, country) )
|
if ( !IsDSTApplicable(year, country) )
|
||||||
{
|
{
|
||||||
// no DST time in this year in this country
|
// no DST time in this year in this country
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return IsBetween(GetBeginDST(year, country), GetEndDST(year, country));
|
return IsBetween(GetBeginDST(year, country), GetEndDST(year, country));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user