提交 6418035f 编写于 作者: B Bomin Zhang

temporary fix of negative time

上级 55125ecf
......@@ -371,9 +371,13 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
tt = (time_t)(val / 1000);
}
/* comment out as it make testcases like select_with_tags.sim fail.
but in windows, this may cause the call to localtime crash if tt < 0,
need to find a better solution.
if (tt < 0) {
tt = 0;
}
*/
struct tm* ptm = localtime(&tt);
size_t pos = strftime(buf, 32, "%Y-%m-%d %H:%M:%S", ptm);
......
......@@ -783,9 +783,13 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
break;
case TSDB_DATA_TYPE_TIMESTAMP:
tt = *(int64_t *)row[i] / 1000;
/* comment out as it make testcases like select_with_tags.sim fail.
but in windows, this may cause the call to localtime crash if tt < 0,
need to find a better solution.
if (tt < 0) {
tt = 0;
}
*/
tp = localtime(&tt);
strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", tp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册