From 909b02e008d2e940b13e77d5429e0b1582ac5120 Mon Sep 17 00:00:00 2001 From: Benguang Zhao Date: Tue, 9 Aug 2022 14:04:57 +0800 Subject: [PATCH] fix: count the number of aligned time intervals properly --- src/os/src/detail/osTime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c index 3590703695..45f630e1eb 100644 --- a/src/os/src/detail/osTime.c +++ b/src/os/src/detail/osTime.c @@ -573,7 +573,7 @@ int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char skey = tmp; } if (unit != 'n' && unit != 'y') { - return (int32_t)((ekey - skey) / interval); + return (int32_t)(ekey/interval - skey/interval); } skey /= (int64_t)(TSDB_TICK_PER_SECOND(precision)); @@ -592,7 +592,7 @@ int32_t taosTimeCountInterval(int64_t skey, int64_t ekey, int64_t interval, char interval *= 12; } - return (emon - smon) / (int32_t)interval; + return (int32_t)(emon/interval - smon/interval); } int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precision) { -- GitLab