From 265b1f3c91ce1adb4e640e359f5ab12ac898c3d6 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Tue, 4 Jul 2023 14:41:27 +0000 Subject: use local assignment to $ENV{TZ} like we do for signal handlers --- usr.sbin/pkg_add/OpenBSD/PackingElement.pm | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'usr.sbin/pkg_add') diff --git a/usr.sbin/pkg_add/OpenBSD/PackingElement.pm b/usr.sbin/pkg_add/OpenBSD/PackingElement.pm index d9d4d29ae35..8e0481f65f7 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.288 2023/07/04 13:58:01 espie Exp $ +# $OpenBSD: PackingElement.pm,v 1.289 2023/07/04 14:41:26 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1952,14 +1952,8 @@ sub _iso8601_to_time($s) my ($year, $month, $day, $hour, $min, $sec) = ($1 - 1900, $2-1, $3, $4, $5, $6); require POSIX; - my $oldtz = $ENV{TZ}; - $ENV{TZ} = 'UTC'; + local $ENV{TZ} = 'UTC'; my $t = POSIX::mktime($sec, $min, $hour, $day, $month, $year); - if (defined $oldtz) { - $ENV{TZ} = $oldtz; - } else { - delete $ENV{TZ}; - } return $t; } else { die "Incorrect ISO8601 timestamp: $s"; -- cgit v1.2.3