未验证 提交 13387940 编写于 作者: O openharmony_ci 提交者: Gitee

!777 修复代码静态检查(0608)

Merge pull request !777 from Mupceet/master
......@@ -53,8 +53,10 @@ static void LogToFile(const char *logFile, const char *tag, const char *info)
FILE *outfile = NULL;
INIT_CHECK_ONLY_RETURN((outfile = fopen(logFile, "a+")) != NULL);
struct tm t;
char dateTime[80]; // 80 data time
strftime(dateTime, sizeof(dateTime), "%Y-%m-%d %H:%M:%S", localtime_r(&curr.tv_sec, &t));
char dateTime[80] = {"00-00-00 00:00:00"}; // 80 data time
if (localtime_r(&curr.tv_sec, &t) != NULL) {
strftime(dateTime, sizeof(dateTime), "%Y-%m-%d %H:%M:%S", &t);
}
(void)fprintf(outfile, "[%s.%ld][pid=%d %d][%s]%s \n", dateTime, curr.tv_nsec, getpid(), gettid(), tag, info);
(void)fflush(outfile);
fclose(outfile);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册