提交 6e2ae854 编写于 作者: M Mupceet

codex

Signed-off-by: NMupceet <laiguizhong@huawei.com>
上级 efb375a4
......@@ -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.
先完成此消息的编辑!
想要评论请 注册