log: Only use one string buffer
This also fixes a mismatch between date_string and sizeof string in the strftime call.
This commit is contained in:
parent
a58290b38b
commit
9ae2f111d4
11
src/log.c
11
src/log.c
@ -47,18 +47,15 @@ static int weston_log_timestamp(void)
|
|||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
|
|
||||||
brokendown_time = localtime(&tv.tv_sec);
|
brokendown_time = localtime(&tv.tv_sec);
|
||||||
|
|
||||||
strftime(string, sizeof string, "%H:%M:%S", brokendown_time);
|
|
||||||
|
|
||||||
if (brokendown_time->tm_mday != cached_tm_mday) {
|
if (brokendown_time->tm_mday != cached_tm_mday) {
|
||||||
char date_string[128];
|
strftime(string, sizeof string, "%Y-%m-%d %Z", brokendown_time);
|
||||||
|
fprintf(weston_logfile, "Date: %s\n", string);
|
||||||
strftime(date_string, sizeof string, "%Y-%m-%d %Z", brokendown_time);
|
|
||||||
fprintf(weston_logfile, "Date: %s\n", date_string);
|
|
||||||
|
|
||||||
cached_tm_mday = brokendown_time->tm_mday;
|
cached_tm_mday = brokendown_time->tm_mday;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strftime(string, sizeof string, "%H:%M:%S", brokendown_time);
|
||||||
|
|
||||||
return fprintf(weston_logfile, "[%s.%03li] ", string, tv.tv_usec/1000);
|
return fprintf(weston_logfile, "[%s.%03li] ", string, tv.tv_usec/1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user