mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix whitespace in function about to be extracted.
This commit is contained in:
parent
158b17d582
commit
a7ca20572d
@ -613,66 +613,68 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {}
|
|||||||
{
|
{
|
||||||
IANAParser::IANAParser parser(tzname);
|
IANAParser::IANAParser parser(tzname);
|
||||||
auto last_info = std::find_if(parser.tzinfo.begin(), parser.tzinfo.end(),
|
auto last_info = std::find_if(parser.tzinfo.begin(), parser.tzinfo.end(),
|
||||||
[](IANAParser::TZInfo tz)
|
[](IANAParser::TZInfo tz)
|
||||||
{return !tz.info.isdst;});
|
{return !tz.info.isdst;});
|
||||||
auto last_time = ptime();
|
auto last_time = ptime();
|
||||||
DSTRule::DSTRule last_rule;
|
DSTRule::DSTRule last_rule;
|
||||||
using boost::gregorian::date;
|
using boost::gregorian::date;
|
||||||
using boost::posix_time::ptime;
|
using boost::posix_time::ptime;
|
||||||
using boost::posix_time::time_duration;
|
using boost::posix_time::time_duration;
|
||||||
for (auto txi = parser.transitions.begin();
|
for (auto txi = parser.transitions.begin();
|
||||||
txi != parser.transitions.end(); ++txi)
|
txi != parser.transitions.end(); ++txi)
|
||||||
{
|
{
|
||||||
auto this_info = parser.tzinfo.begin() + txi->index;
|
auto this_info = parser.tzinfo.begin() + txi->index;
|
||||||
//Can't use boost::posix_date::from_time_t() constructor because it
|
//Can't use boost::posix_date::from_time_t() constructor because it
|
||||||
//silently casts the time_t to an int32_t.
|
//silently casts the time_t to an int32_t.
|
||||||
auto this_time = ptime(date(1970, 1, 1),
|
auto this_time = ptime(date(1970, 1, 1),
|
||||||
time_duration(txi->timestamp / 3600, 0,
|
time_duration(txi->timestamp / 3600, 0,
|
||||||
txi->timestamp % 3600));
|
txi->timestamp % 3600));
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto this_year = this_time.date().year();
|
auto this_year = this_time.date().year();
|
||||||
//Initial case
|
//Initial case
|
||||||
if (last_time.is_not_a_date_time())
|
if (last_time.is_not_a_date_time())
|
||||||
zone_vector.push_back(zone_no_dst(this_year - 1, last_info));
|
zone_vector.push_back(zone_no_dst(this_year - 1, last_info));
|
||||||
//gap in transitions > 1 year, non-dst zone
|
//gap in transitions > 1 year, non-dst zone
|
||||||
//change. In the last case the exact date of the change will be
|
//change. In the last case the exact date of the change will be
|
||||||
//wrong because boost::local_date::timezone isn't able to
|
//wrong because boost::local_date::timezone isn't able to
|
||||||
//represent it. For GnuCash's purposes this isn't likely to be
|
//represent it. For GnuCash's purposes this isn't likely to be
|
||||||
//important as the last time this sort of transition happened
|
//important as the last time this sort of transition happened
|
||||||
//was 1946, but we have to handle the case in order to parse
|
//was 1946, but we have to handle the case in order to parse
|
||||||
//the tz file.
|
//the tz file.
|
||||||
else if (this_year - last_time.date().year() > 1 ||
|
else if (this_year - last_time.date().year() > 1 ||
|
||||||
last_info->info.isdst == this_info->info.isdst)
|
last_info->info.isdst == this_info->info.isdst)
|
||||||
{
|
{
|
||||||
zone_vector.push_back(zone_no_dst(this_year, last_info));
|
zone_vector.push_back(zone_no_dst(this_year, last_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DSTRule::DSTRule new_rule(last_info, this_info,
|
DSTRule::DSTRule new_rule(last_info, this_info,
|
||||||
last_time, this_time);
|
last_time, this_time);
|
||||||
if (new_rule != last_rule)
|
if (new_rule != last_rule)
|
||||||
{
|
{
|
||||||
last_rule = new_rule;
|
last_rule = new_rule;
|
||||||
zone_vector.push_back(zone_from_rule (this_time.date().year(),
|
zone_vector.push_back(zone_from_rule (this_time.date().year(),
|
||||||
new_rule));
|
new_rule));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(boost::gregorian::bad_year err)
|
catch(const boost::gregorian::bad_year& err)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
last_time = this_time;
|
last_time = this_time;
|
||||||
last_info = this_info;
|
last_info = this_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_time.is_not_a_date_time() ||
|
if (last_time.is_not_a_date_time() ||
|
||||||
last_time.date().year() < parser.last_year)
|
last_time.date().year() < parser.last_year)
|
||||||
zone_vector.push_back(zone_no_dst(max_year, last_info));
|
zone_vector.push_back(zone_no_dst(max_year, last_info));
|
||||||
else //Last DST rule forever after.
|
else //Last DST rule forever after.
|
||||||
zone_vector.push_back(zone_from_rule(max_year, last_rule));
|
zone_vector.push_back(zone_from_rule(max_year, last_rule));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user