mirror of
https://github.com/HowardHinnant/date.git
synced 2025-01-13 17:34:45 +08:00
Guard against Posix::time_zone having transition near ...
beginning or end of year.
This commit is contained in:
parent
5f8c904231
commit
28972d72b4
@ -452,6 +452,10 @@ time_zone::get_info(date::sys_time<Duration> st) const
|
|||||||
if (start_rule_.ok())
|
if (start_rule_.ok())
|
||||||
{
|
{
|
||||||
auto y = year_month_day{floor<days>(st)}.year();
|
auto y = year_month_day{floor<days>(st)}.year();
|
||||||
|
if (st >= get_next_start(y))
|
||||||
|
++y;
|
||||||
|
else if (st < get_prev_end(y))
|
||||||
|
--y;
|
||||||
auto start = get_start(y);
|
auto start = get_start(y);
|
||||||
auto end = get_end(y);
|
auto end = get_end(y);
|
||||||
if (start <= end) // (northern hemisphere)
|
if (start <= end) // (northern hemisphere)
|
||||||
@ -505,6 +509,7 @@ time_zone::get_info(date::sys_time<Duration> st) const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
r = contant_offset();
|
r = contant_offset();
|
||||||
|
assert(r.begin <= st && st < r.end);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user