summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2024-04-30 14:26:51 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2024-04-30 14:26:51 +0000
commit119a1b587cad9d2bcc79b221318729377423442b (patch)
tree43c2f7acbd16658d07c07fcf6cef10865c043f98 /usr.sbin/pkg_add
parent283d7b89ab80b962eeca31509da6c12fb11b3c1e (diff)
Allow parsing either RFC9557 timestamps (which wants explicit +00:00) or
the existing format (with Z). From espie.
Diffstat (limited to 'usr.sbin/pkg_add')
-rw-r--r--usr.sbin/pkg_add/OpenBSD/PackingElement.pm6
1 files 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 <espie@openbsd.org>
#
@@ -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;