From 98aace14ae943b5308a5b444c9a7c8ec0dd2f903 Mon Sep 17 00:00:00 2001 From: Victor Krasnov Date: Mon, 22 May 2023 09:23:23 +0000 Subject: [PATCH] Add DATE_SECONDS_PER_DAY macro definition to replace the numeric literal 86400 --- src/Common/DateLUTImpl.h | 2 ++ src/Functions/FunctionsConversion.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Common/DateLUTImpl.h b/src/Common/DateLUTImpl.h index b40b4d7c65b..551375d1f5c 100644 --- a/src/Common/DateLUTImpl.h +++ b/src/Common/DateLUTImpl.h @@ -10,6 +10,8 @@ #include +#define DATE_SECONDS_PER_DAY 86400 /// Number of seconds in a day, 60 * 60 * 24 + #define DATE_LUT_MIN_YEAR 1900 /// 1900 since majority of financial organizations consider 1900 as an initial year. #define DATE_LUT_MAX_YEAR 2299 /// Last supported year (complete) #define DATE_LUT_YEARS (1 + DATE_LUT_MAX_YEAR - DATE_LUT_MIN_YEAR) /// Number of years in lookup table diff --git a/src/Functions/FunctionsConversion.h b/src/Functions/FunctionsConversion.h index 2e21932d0e2..940585d6d57 100644 --- a/src/Functions/FunctionsConversion.h +++ b/src/Functions/FunctionsConversion.h @@ -300,7 +300,7 @@ struct ConvertImpl if constexpr (std::is_same_v && std::is_same_v) vec_to[i] = static_cast(static_cast(vec_from[i])); else if constexpr (std::is_same_v && (std::is_same_v || std::is_same_v)) - vec_to[i] = static_cast(vec_from[i] * 86400); + vec_to[i] = static_cast(vec_from[i] * DATE_SECONDS_PER_DAY); else vec_to[i] = static_cast(vec_from[i]); }