From 4c7629f590bb18855e478a826833adb05d2a128b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 8 Jun 2024 15:35:47 -0700 Subject: [PATCH 1/2] fix -Wformat-y2k error %c potentially prints a 2 digit year. Just use a normal format. --- src/iperf_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iperf_error.c b/src/iperf_error.c index 0fedf3110..f4172d0d1 100644 --- a/src/iperf_error.c +++ b/src/iperf_error.c @@ -99,7 +99,7 @@ iperf_errexit(struct iperf_test *test, const char *format, ...) if (test != NULL && test->timestamps) { time(&now); ltm = localtime(&now); - strftime(iperf_timestrerr, sizeof(iperf_timestrerr), "%c ", ltm); + strftime(iperf_timestrerr, sizeof(iperf_timestrerr), "%Y-%m-%d %H:%M:%S", ltm); ct = iperf_timestrerr; } From 33838da76c71d2b458529b532b184bb9fe50931e Mon Sep 17 00:00:00 2001 From: "Bruce A. Mah" Date: Thu, 27 Jun 2024 14:06:25 -0700 Subject: [PATCH 2/2] Use user-provided timestasmp format string specifier for errors. This change provides consistent behavior relative to more routine (non-error) timestamped output. --- src/iperf_error.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iperf_error.c b/src/iperf_error.c index f4172d0d1..ce925a81f 100644 --- a/src/iperf_error.c +++ b/src/iperf_error.c @@ -99,7 +99,7 @@ iperf_errexit(struct iperf_test *test, const char *format, ...) if (test != NULL && test->timestamps) { time(&now); ltm = localtime(&now); - strftime(iperf_timestrerr, sizeof(iperf_timestrerr), "%Y-%m-%d %H:%M:%S", ltm); + strftime(iperf_timestrerr, sizeof(iperf_timestrerr), iperf_get_test_timestamp_format(test), ltm); ct = iperf_timestrerr; }