diff --git a/tz.h b/tz.h index 96e3a29..8bf5c05 100644 --- a/tz.h +++ b/tz.h @@ -319,9 +319,9 @@ Zone::to_sys_impl(std::chrono::time_point(tp_sys) - i.begin <= days{1}) { - if (tp < i.begin + i.offset) + if (floor(tp) < i.begin + i.offset) { if (do_throw) { @@ -331,13 +331,13 @@ Zone::to_sys_impl(std::chrono::time_point= i.begin + get_info(i.begin - seconds{1}, tz::utc).offset); + assert(floor(tp) >= i.begin + get_info(i.begin - seconds{1}, tz::utc).offset); } - if (i.end - tp_sys <= days{1}) + if (i.end - floor(tp_sys) <= days{1}) { - assert(tp < i.end + i.offset); + assert(floor(tp) < i.end + i.offset); auto next = get_info(i.end, tz::utc); - if (tp >= i.end + next.offset) + if (floor(tp) >= i.end + next.offset) { if (do_throw) throw ambiguous_local_time(tp, i.offset, i.abbrev,