未验证 提交 11bb3e3a 编写于 作者: A alexey-milovidov 提交者: GitHub

Merge pull request #10513 from ClickHouse/fix-fractional-timezones-overflow

Fix overflow at beginning of unix epoch for fractional timezones
......@@ -287,8 +287,8 @@ public:
if (offset_is_whole_number_of_hours_everytime)
return (t / 60) % 60;
time_t date = find(t).date;
return (t - date) / 60 % 60;
UInt32 date = find(t).date;
return (UInt32(t) - date) / 60 % 60;
}
inline time_t toStartOfMinute(time_t t) const { return t / 60 * 60; }
......@@ -301,9 +301,8 @@ public:
if (offset_is_whole_number_of_hours_everytime)
return t / 3600 * 3600;
time_t date = find(t).date;
/// Still can return wrong values for time at 1970-01-01 if the UTC offset was non-whole number of hours.
return date + (t - date) / 3600 * 3600;
UInt32 date = find(t).date;
return date + (UInt32(t) - date) / 3600 * 3600;
}
/** Number of calendar day since the beginning of UNIX epoch (1970-01-01 is zero)
......
SELECT toDateTime(10000, 'Asia/Calcutta');
SELECT toMinute(toDateTime(10000, 'Asia/Calcutta'));
SELECT toStartOfHour(toDateTime(10000, 'Asia/Calcutta'));
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册