Merge branch 'branch-0.3.1' into 'branch-0.3.1'

date range check

See merge request megasearch/milvus!167

Former-commit-id: dfb0d6942890fc82a3a7270b7aae627683e0eb0e
pull/191/head
jinhai 2019-07-07 20:43:46 +08:00
commit 9ec9b3fc26
1 changed files with 7 additions and 1 deletions

View File

@ -109,7 +109,13 @@ namespace {
}
long days = (tt_end > tt_start) ? (tt_end - tt_start)/DAY_SECONDS : (tt_start - tt_end)/DAY_SECONDS;
for(long i = 0; i <= days; i++) {
if(days == 0) {
error_code = SERVER_INVALID_TIME_RANGE;
error_msg = "Invalid time range: " + range.start_value + " to " + range.end_value;
return ;
}
for(long i = 0; i < days; i++) {
time_t tt_day = tt_start + DAY_SECONDS*i;
tm tm_day;
CommonUtil::ConvertTime(tt_day, tm_day);