Update GregorianDate.h

This commit is contained in:
Alexey Milovidov 2022-10-19 17:36:49 +03:00 committed by GitHub
parent b0dd95447d
commit 898c935d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -328,17 +328,16 @@ namespace DB
} }
} }
template <typename YearT>
template <is_integer TDay> template <is_integer TDay>
OrdinalDate<YearT>::OrdinalDate(TDay modified_julian_day) OrdinalDate<YearT>::OrdinalDate(TDay modified_julian_day)
{ {
/// This function supports day number from -678941 to 2973119 (which represent 0000-01-01 and 9999-12-31 respectively). /// This function supports day number from -678941 to 2973119 (which represent 0000-01-01 and 9999-12-31 respectively).
if constexpr (is_signed_v<decltype(modified_julian_day)> && std::numeric_limits<decltype(modified_julian_day)>::lowest() < -678941) if constexpr (is_signed_v<TDay> && std::numeric_limits<TDay>::lowest() < -678941)
if (modified_julian_day < -678941) if (modified_julian_day < -678941)
modified_julian_day = -678941; modified_julian_day = -678941;
if constexpr (std::numeric_limits<decltype(modified_julian_day)>::max() > 2973119) if constexpr (std::numeric_limits<TDay>::max() > 2973119)
if (modified_julian_day > 2973119) if (modified_julian_day > 2973119)
modified_julian_day = 2973119; modified_julian_day = 2973119;