From: Alejandro Colomar Date: Thu, 1 Aug 2024 10:32:12 +0000 (+0200) Subject: lib/, src/: Use %F instead of %Y-%m-%d with strftime(3) X-Git-Tag: 4.17.0-rc1~90 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=683b3caa6237ab05c026b6b351f04410750481a5;p=thirdparty%2Fshadow.git lib/, src/: Use %F instead of %Y-%m-%d with strftime(3) %F is specified by ISO C99. It adds semantic meaning as printing an ISO 8601 date. Scripted change: $ cat ~/tmp/spatch/strftime_F.sp @@ @@ - "%Y-%m-%d" + "%F" $ find contrib/ lib* src/ -type f \ | xargs spatch --sp-file ~/tmp/spatch/strftime_F.sp --in-place Signed-off-by: Alejandro Colomar --- diff --git a/lib/time/day_to_str.h b/lib/time/day_to_str.h index f908a7524..b70e98975 100644 --- a/lib/time/day_to_str.h +++ b/lib/time/day_to_str.h @@ -43,7 +43,7 @@ day_to_str(size_t size, char buf[size], long day) return; } - if (strftime(buf, size, "%Y-%m-%d", &tm) == 0) + if (strftime(buf, size, "%F", &tm) == 0) strtcpy(buf, "future", size); } diff --git a/src/chage.c b/src/chage.c index 5146fde0a..c990953b5 100644 --- a/src/chage.c +++ b/src/chage.c @@ -247,7 +247,7 @@ print_day_as_date(long day) return; } - STRFTIME(buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", &tm); + STRFTIME(buf, iflg ? "%F" : "%b %d, %Y", &tm); (void) puts (buf); }