Fix issue

This commit is contained in:
Alexey Milovidov 2021-03-15 23:29:35 +03:00
parent 671395e8c8
commit f48bf2aaba
2 changed files with 13 additions and 4 deletions

View File

@ -985,9 +985,18 @@ public:
if (time >= values.time_at_offset_change())
time += values.amount_of_offset_change();
res.time.second = time % 60;
res.time.minute = time / 60 % 60;
res.time.hour = time / 3600;
if (unlikely(time < 0))
{
res.time.second = 0;
res.time.minute = 0;
res.time.hour = 0;
}
else
{
res.time.second = time % 60;
res.time.minute = time / 60 % 60;
res.time.hour = time / 3600;
}
/// In case time was changed backwards at the start of next day, we will repeat the hour 23.
if (unlikely(res.time.hour > 23))

View File

@ -6,4 +6,4 @@ SELECT toString(toDateTime('9922337203.6854775808', 1));
SELECT toDateTime64(CAST('10000000000.1' AS Decimal64(1)), 1);
2283-11-11 23:46:40.1
SELECT toDateTime64(CAST('-10000000000.1' AS Decimal64(1)), 1);
1925-01-01 23:09:20.1
1925-01-01 00:00:00.1