DateLUT: simpler, safer and more efficient [#CLICKHOUSE-2]

This commit is contained in:
Alexey Milovidov 2018-12-24 00:45:28 +03:00
parent 8367c99720
commit 344d610ef0

View File

@ -56,6 +56,7 @@ DateLUTImpl::DateLUTImpl(const std::string & time_zone_)
cctz::time_zone::absolute_lookup start_of_epoch_lookup = cctz_time_zone.lookup(std::chrono::system_clock::from_time_t(start_of_day)); cctz::time_zone::absolute_lookup start_of_epoch_lookup = cctz_time_zone.lookup(std::chrono::system_clock::from_time_t(start_of_day));
offset_at_start_of_epoch = start_of_epoch_lookup.offset; offset_at_start_of_epoch = start_of_epoch_lookup.offset;
offset_is_whole_number_of_hours_everytime = true;
cctz::civil_day date{1970, 1, 1}; cctz::civil_day date{1970, 1, 1};
@ -83,6 +84,9 @@ DateLUTImpl::DateLUTImpl(const std::string & time_zone_)
values.time_at_offset_change = 0; values.time_at_offset_change = 0;
values.amount_of_offset_change = 0; values.amount_of_offset_change = 0;
if (start_of_day % 3600)
offset_is_whole_number_of_hours_everytime = false;
/// If UTC offset was changed in previous day. /// If UTC offset was changed in previous day.
if (i != 0) if (i != 0)
{ {