mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 17:41:59 +00:00
Merge pull request #32240 from benbiti/master
Fix unix timestamp Millisecond convert to DateTime64, fractional part calc reversed
This commit is contained in:
commit
826f7cb0f5
@ -899,13 +899,8 @@ inline ReturnType readDateTimeTextImpl(DateTime64 & datetime64, UInt32 scale, Re
|
||||
{
|
||||
/// Unix timestamp with subsecond precision, already scaled to integer.
|
||||
/// For disambiguation we support only time since 2001-09-09 01:46:40 UTC and less than 30 000 years in future.
|
||||
|
||||
for (size_t i = 0; i < scale; ++i)
|
||||
{
|
||||
components.fractional *= 10;
|
||||
components.fractional += components.whole % 10;
|
||||
components.whole /= 10;
|
||||
}
|
||||
components.fractional = components.whole % common::exp10_i32(scale);
|
||||
components.whole = components.whole / common::exp10_i32(scale);
|
||||
}
|
||||
|
||||
datetime64 = DecimalUtils::decimalFromComponents<DateTime64>(components, scale);
|
||||
|
@ -0,0 +1,2 @@
|
||||
2283-11-11 23:48:05.4775806
|
||||
2283-11-11 23:52:48.54775806
|
@ -1,2 +1,2 @@
|
||||
SELECT toDateTime('9223372036854775806', 7); -- { serverError 407 }
|
||||
SELECT toDateTime('9223372036854775806', 8); -- { serverError 407 }
|
||||
SELECT toDateTime('9223372036854775806', 7);
|
||||
SELECT toDateTime('9223372036854775806', 8);
|
||||
|
Loading…
Reference in New Issue
Block a user