[TD-225]fix endless loop.
This commit is contained in:
parent
beeab48cc9
commit
84b867e25e
|
@ -501,10 +501,24 @@ int64_t taosTimeTruncate(int64_t t, const SInterval* pInterval, int32_t precisio
|
|||
start += (int64_t)(timezone * TSDB_TICK_PER_SECOND(precision));
|
||||
}
|
||||
|
||||
int64_t end = start + pInterval->interval - 1;
|
||||
while(end < t) { // move forward to the correct time window
|
||||
start += pInterval->sliding;
|
||||
int64_t end = 0;
|
||||
|
||||
// not enough time range
|
||||
if (INT64_MAX - start > pInterval->interval - 1) {
|
||||
end = start + pInterval->interval - 1;
|
||||
|
||||
while(end < t && ((start + pInterval->sliding) <= INT64_MAX)) { // move forward to the correct time window
|
||||
start += pInterval->sliding;
|
||||
|
||||
if (INT64_MAX - start > pInterval->interval - 1) {
|
||||
end = start + pInterval->interval - 1;
|
||||
} else {
|
||||
end = INT64_MAX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
end = INT64_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue