Fix error

This commit is contained in:
Alexey Milovidov 2021-03-07 02:36:24 +03:00
parent d406999e8f
commit 8271cec093
2 changed files with 4 additions and 7 deletions

View File

@ -112,9 +112,7 @@ DateLUTImpl::DateLUTImpl(const std::string & time_zone_)
/// Change in time zone without transition is possible, e.g. Moscow 1991 Sun, 31 Mar, 02:00 MSK to EEST
cctz::time_zone::civil_transition transition{};
if (cctz_time_zone.next_transition(start_of_day_time_point - std::chrono::seconds(1), &transition)
&& transition.from.year() == date.year()
&& transition.from.month() == date.month()
&& transition.from.day() == date.day()
&& (cctz::civil_day(transition.from) == date || cctz::civil_day(transition.to) == date)
&& transition.from != transition.to)
{
values.time_at_offset_change_value = (transition.from - cctz::civil_second(date)) / Values::OffsetChangeFactor;

View File

@ -416,11 +416,11 @@ TEST_P(DateLUTWithTimeZoneAndTimeRange, InRange)
has_transition = true;
}
if (has_transition && (transition.from.second() != 0 || transition.from.minute() % 900 != 0))
if (has_transition && (transition.from.second() != 0 || transition.from.minute() % 15 != 0))
{
std::cerr << "Skipping " << timezone_name << " " << tz_time
<< " because of unsupported timezone transition from " << transition.from << " to " << transition.to
<< " (not divisable by 15 minutes)\n";
<< " (not divisible by 15 minutes)\n";
continue;
}
@ -436,8 +436,7 @@ TEST_P(DateLUTWithTimeZoneAndTimeRange, InRange)
/// To large transition.
if (has_transition
&& cctz::civil_day(transition.from) != cctz::civil_day(transition.to)
&& cctz::civil_day(transition.from) != cctz::civil_day(transition.to) + 1)
&& std::abs(transition.from - transition.to) > 3600 * 3)
{
std::cerr << "Skipping " << timezone_name << " " << tz_time
<< " because of unsupported timezone transition from " << transition.from << " to " << transition.to