Date: Wed, 22 Oct 2025 20:15:28 GMT From: Colin Percival <cperciva@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 0948c4d4a330 - releng/15.0 - libc: Add "Z" as TZ designator for strptime. Message-ID: <202510222015.59MKFSJd033154@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch releng/15.0 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=0948c4d4a3308737879342d87efc311913ee4335 commit 0948c4d4a3308737879342d87efc311913ee4335 Author: Gordon Tetlow <gordon@FreeBSD.org> AuthorDate: 2025-10-15 22:24:06 +0000 Commit: Colin Percival <cperciva@FreeBSD.org> CommitDate: 2025-10-22 20:12:30 +0000 libc: Add "Z" as TZ designator for strptime. ISO 8601 allows use of "Z" as the time zone designator. Update the strptime parser to allow this usage. While we are at it, update the manpage to reflect that both UTC and Z are now valid options. Approved by: re (cperciva) Reviewed by: des MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53083 (cherry picked from commit 79e57ea662d92ffcbe7d65854a284aefac6a332d) (cherry picked from commit 3d368c699b73cc1dff3ca27d29d19666741d9ff8) --- lib/libc/stdtime/strptime.3 | 2 +- lib/libc/stdtime/strptime.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/libc/stdtime/strptime.3 b/lib/libc/stdtime/strptime.3 index 7df73d2d080a..9456fa757b85 100644 --- a/lib/libc/stdtime/strptime.3 +++ b/lib/libc/stdtime/strptime.3 @@ -171,7 +171,7 @@ is taken as noon. The .Fa %Z format specifier only accepts time zone abbreviations of the local time zone, -or the value "GMT". +and the values "GMT", "UTC", or "Z". This limitation is because of ambiguity due to of the over loading of time zone abbreviations. One such example is diff --git a/lib/libc/stdtime/strptime.c b/lib/libc/stdtime/strptime.c index 5f1293c7a267..375e49146639 100644 --- a/lib/libc/stdtime/strptime.c +++ b/lib/libc/stdtime/strptime.c @@ -546,7 +546,8 @@ label: zonestr[cp - buf] = '\0'; tzset(); if (0 == strcmp(zonestr, "GMT") || - 0 == strcmp(zonestr, "UTC")) { + 0 == strcmp(zonestr, "UTC") || + 0 == strcmp(zonestr, "Z")) { *GMTp = 1; } else if (0 == strcmp(zonestr, tzname[0])) { tm->tm_isdst = 0;help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202510222015.59MKFSJd033154>
