From eb799928766efd111ad429f6dc61d2b0c3859e37 Mon Sep 17 00:00:00 2001 From: sthen Date: Tue, 30 Apr 2024 14:26:50 +0000 Subject: [PATCH] Allow parsing either RFC9557 timestamps (which wants explicit +00:00) or the existing format (with Z). From espie. --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index 6a3387efc39..e0110c0bb56 100644 --- a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm +++ b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: PackingElement.pm,v 1.290 2023/11/22 11:18:37 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.291 2024/04/30 14:26:50 sthen Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1957,7 +1957,9 @@ sub iso8601($self) sub _iso8601_to_time($s) { - if ($s =~ m/^(\d{4})\-(\d{2})\-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})Z$/) { + # XXX RFC 9557 explicitly wants +00:00 instead of Z for UTC, + # so recognize both + if ($s =~ m/^(\d{4})\-(\d{2})\-(\d{2})T(\d{2})\:(\d{2})\:(\d{2})(?:Z|\+00\:00)$/) { my ($year, $month, $day, $hour, $min, $sec) = ($1 - 1900, $2-1, $3, $4, $5, $6); require POSIX; -- 2.20.1