Found this when looking at the timezone issue a couple of weeks back and
then forgot about it:
This setenv() + localtime() looks like a hack to me and I don't really
understand why it should be preferable over using gmtime() directly. The
only change in output that I can see is that it causes %Z to print GMT
instead of UTC, so I modified the format string accordingly (but I have
no strong opinion on this).
Index: output.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/output.c,v
retrieving revision 1.25
diff -u -p -r1.25 output.c
--- output.c 19 Apr 2022 13:52:24 -0000 1.25
+++ output.c 19 Apr 2022 15:55:44 -0000
@@ -204,9 +204,8 @@ outputheader(FILE *out, struct stats *st
int i;
time(&t);
- setenv("TZ", "UTC", 1);
- tp = localtime(&t);
- strftime(tbuf, sizeof tbuf, "%a %b %e %H:%M:%S %Z %Y", tp);
+ tp = gmtime(&t);
+ strftime(tbuf, sizeof tbuf, "%a %b %e %H:%M:%S UTC %Y", tp);
gethostname(hn, sizeof hn);
Index: output-json.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/output-json.c,v
retrieving revision 1.24
diff -u -p -r1.24 output-json.c
--- output-json.c 19 Apr 2022 13:52:24 -0000 1.24
+++ output-json.c 19 Apr 2022 14:18:04 -0000
@@ -31,8 +31,7 @@ outputheader_json(FILE *out, struct stat
int i;
time(&t);
- setenv("TZ", "UTC", 1);
- tp = localtime(&t);
+ tp = gmtime(&t);
strftime(tbuf, sizeof tbuf, "%FT%TZ", tp);
gethostname(hn, sizeof hn);