index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Florian Wehner <florian@whnr.de> | 2019-03-07 20:14:55 -0500 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2019-03-19 11:53:30 +1000 |
commit | c61cd050f9b6475ea128a1da02e88b284ac509b5 (patch) | |
tree | 943d9466c0c0d865dc830d9cd0d3abd650a7bd7e | |
parent | c0e9be7973be6c81b22fde91516fb8991e7bb07b (diff) |
-rw-r--r-- | lib/libalpm/log.c | 8 |
diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index e46ad3c3..d8842a55 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -22,6 +22,7 @@ #include <stdarg.h> #include <errno.h> #include <syslog.h> +#include <time.h> /* libalpm */ #include "log.h" @@ -38,11 +39,12 @@ static int _alpm_log_leader(FILE *f, const char *prefix) { time_t t = time(NULL); struct tm *tm = localtime(&t); + int length = 32; + char timestamp[length]; /* Use ISO-8601 date format */ - return fprintf(f, "[%04d-%02d-%02d %02d:%02d] [%s] ", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, prefix); + strftime(timestamp,length,"%FT%X%z", tm); + return fprintf(f, "[%s] [%s] ", timestamp, prefix); } /** A printf-like function for logging. |