提交 f790a124 编写于 作者: S Shengliang Guan

localtime func crash in windows

上级 7da7b617
...@@ -379,6 +379,10 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) { ...@@ -379,6 +379,10 @@ static char* formatTimestamp(char* buf, int64_t val, int precision) {
} }
*/ */
#ifdef WINDOWS
if (tt < 0) tt = 0;
#endif
struct tm* ptm = localtime(&tt); struct tm* ptm = localtime(&tt);
size_t pos = strftime(buf, 32, "%Y-%m-%d %H:%M:%S", ptm); size_t pos = strftime(buf, 32, "%Y-%m-%d %H:%M:%S", ptm);
......
...@@ -791,6 +791,10 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) { ...@@ -791,6 +791,10 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
} }
*/ */
#ifdef WINDOWS
if (tt < 0) tt = 0;
#endif
tp = localtime(&tt); tp = localtime(&tt);
strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", tp); strftime(timeStr, 64, "%y-%m-%d %H:%M:%S", tp);
sprintf(value, "%s.%03d", timeStr, sprintf(value, "%s.%03d", timeStr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册