fix fid error when ts < 0

This commit is contained in:
dapan1121 2021-03-19 14:24:39 +08:00
parent 31e5c26bdd
commit 6eeebb0b2c
1 changed files with 4 additions and 0 deletions

View File

@ -842,6 +842,10 @@ static int32_t getFileIdFromKey(TSKEY key, int32_t daysPerFile, int32_t precisio
return INT32_MIN;
}
if (key < 0) {
key -= (daysPerFile * tsMsPerDay[precision]);
}
int64_t fid = (int64_t)(key / (daysPerFile * tsMsPerDay[precision])); // set the starting fileId
if (fid < 0L && llabs(fid) > INT32_MAX) { // data value overflow for INT32
fid = INT32_MIN;