fix(query): fix time window generating bug.
This commit is contained in:
parent
2b4e861f8d
commit
3fba8182a5
|
@ -844,11 +844,14 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
|
||||||
} else {
|
} else {
|
||||||
// try to move current window to the left-hande-side, due to the offset effect.
|
// try to move current window to the left-hande-side, due to the offset effect.
|
||||||
int64_t end = taosTimeAdd(start, pInterval->interval, pInterval->intervalUnit, precision) - 1;
|
int64_t end = taosTimeAdd(start, pInterval->interval, pInterval->intervalUnit, precision) - 1;
|
||||||
ASSERT(end >= t);
|
|
||||||
end = taosTimeAdd(end, -pInterval->sliding, pInterval->slidingUnit, precision);
|
int64_t newEnd = end;
|
||||||
if (end >= t) {
|
while(newEnd >= t) {
|
||||||
start = taosTimeAdd(start, -pInterval->sliding, pInterval->slidingUnit, precision);
|
end = newEnd;
|
||||||
|
newEnd = taosTimeAdd(newEnd, -pInterval->sliding, pInterval->slidingUnit, precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
start = taosTimeAdd(end, -pInterval->interval + 1, pInterval->intervalUnit, precision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue