diff options
Diffstat (limited to 'usr.sbin/rpki-client/output.c')
-rw-r--r-- | usr.sbin/rpki-client/output.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/rpki-client/output.c b/usr.sbin/rpki-client/output.c index ef544fccb81..442664a9b70 100644 --- a/usr.sbin/rpki-client/output.c +++ b/usr.sbin/rpki-client/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.14 2020/05/03 19:41:54 deraadt Exp $ */ +/* $OpenBSD: output.c,v 1.15 2020/05/03 20:24:02 deraadt Exp $ */ /* * Copyright (c) 2019 Theo de Raadt <deraadt@openbsd.org> * @@ -25,6 +25,7 @@ #include <string.h> #include <limits.h> #include <unistd.h> +#include <time.h> #include <openssl/x509v3.h> @@ -173,18 +174,19 @@ set_signal_handler(void) int outputheader(FILE *out, struct stats *st) { - char hn[NI_MAXHOST], tbuf[26]; + char hn[NI_MAXHOST], tbuf[80]; + struct tm *tp; time_t t; time(&t); setenv("TZ", "UTC", 1); - ctime_r(&t, tbuf); - *strrchr(tbuf, '\n') = '\0'; + tp = localtime(&t); + strftime(tbuf, sizeof tbuf, "%a %b %e %H:%M:%S %Z %Y", tp); gethostname(hn, sizeof hn); if (fprintf(out, - "# Generated on host %s at %s UTC\n" + "# Generated on host %s at %s\n" "# Processing time %lld seconds (%lld seconds user, %lld seconds system)\n" "# Route Origin Authorizations: %zu (%zu failed parse, %zu invalid)\n" "# Certificates: %zu (%zu failed parse, %zu invalid)\n" |