From 1d5225d2a5c88bcf53f6d2157e1f9d919c15ee11 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 6 Feb 2021 20:13:19 -0800 Subject: [PATCH] spv-writer: Avoid obsolete function asctime(). Found by cppcheck. Reported by John Darrington. --- src/output/spv/spv-writer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/output/spv/spv-writer.c b/src/output/spv/spv-writer.c index f1f9b96956..549a0d8f84 100644 --- a/src/output/spv/spv-writer.c +++ b/src/output/spv/spv-writer.c @@ -194,8 +194,9 @@ spv_writer_open_file (struct spv_writer *w) time_t t = time (NULL); struct tm *tm = gmtime (&t); - char *tm_s = asctime (tm); - write_attr (w, "creation-date-time", tm_s); + char tm_s[128]; + if (strftime (tm_s, sizeof tm_s, "%x %X", tm)) + write_attr (w, "creation-date-time", tm_s); write_attr (w, "creator", version); -- 2.30.2