Catch out-of-range exception at beginning and end of TZFile on Fedora.

This commit is contained in:
John Ralls 2015-05-04 15:53:23 -07:00
parent 0b55c746c8
commit 577aa3fe02

View File

@ -562,6 +562,8 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {}
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
{
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())
@ -590,6 +592,11 @@ TimeZoneProvider::TimeZoneProvider(const std::string& tzname) : zone_vector {}
new_rule)); new_rule));
} }
} }
}
catch(boost::gregorian::bad_year err)
{
continue;
}
last_time = this_time; last_time = this_time;
last_info = this_info; last_info = this_info;
} }