From 6418035f3edc6efb4f4e05a557273246c2b0360c Mon Sep 17 00:00:00 2001 From: Bomin Zhang Date: Wed, 12 Aug 2020 11:05:34 +0800 Subject: [PATCH] temporary fix of negative time --- src/kit/shell/src/shellEngine.c | 4 ++++ tests/tsim/src/simExe.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/kit/shell/src/shellEngine.c b/src/kit/shell/src/shellEngine.c index a7a69e5f45..2838dc5386 100644 --- a/src/kit/shell/src/shellEngine.c +++ b/src/kit/shell/src/shellEngine.c @@ -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); diff --git a/tests/tsim/src/simExe.c b/tests/tsim/src/simExe.c index 0a1829f7c7..677cea54c2 100644 --- a/tests/tsim/src/simExe.c +++ b/tests/tsim/src/simExe.c @@ -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); -- GitLab