You need to sign in or sign up before continuing.
提交 bf540af8 编写于 作者: J Jiri Denemark 提交者: Eric Blake

logging: Add date to log timestamp

(cherry picked from commit 11c6e094)
上级 fc9a66cf
...@@ -627,8 +627,10 @@ virLogFormatTimestamp(void) ...@@ -627,8 +627,10 @@ virLogFormatTimestamp(void)
gettimeofday(&cur_time, NULL); gettimeofday(&cur_time, NULL);
localtime_r(&cur_time.tv_sec, &time_info); localtime_r(&cur_time.tv_sec, &time_info);
time_info.tm_year += 1900;
if (virAsprintf(&str, "%02d:%02d:%02d.%03d", if (virAsprintf(&str, "%4d-%02d-%02d %02d:%02d:%02d.%03d",
time_info.tm_year, time_info.tm_mon, time_info.tm_mday,
time_info.tm_hour, time_info.tm_min, time_info.tm_sec, time_info.tm_hour, time_info.tm_min, time_info.tm_sec,
(int) (cur_time.tv_usec / 1000)) < 0) (int) (cur_time.tv_usec / 1000)) < 0)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册