use consistent time notation for the log

%X is locale-dependent, making it impossible to reliably parse and
potentially overflowing the buffer.  %T is consistent across locales.

Also fixes some adjacent whitespace.

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2019-06-08 12:50:45 -07:00 committed by Allan McRae
parent 686a9ee8e7
commit 30acc87b7d

View file

@ -39,11 +39,11 @@ static int _alpm_log_leader(FILE *f, const char *prefix)
{ {
time_t t = time(NULL); time_t t = time(NULL);
struct tm *tm = localtime(&t); struct tm *tm = localtime(&t);
int length = 32; int length = 32;
char timestamp[length]; char timestamp[length];
/* Use ISO-8601 date format */ /* Use ISO-8601 date format */
strftime(timestamp,length,"%FT%X%z", tm); strftime(timestamp,length,"%FT%T%z", tm);
return fprintf(f, "[%s] [%s] ", timestamp, prefix); return fprintf(f, "[%s] [%s] ", timestamp, prefix);
} }