summaryrefslogtreecommitdiff
path: root/t/op/time.t
diff options
context:
space:
mode:
authorBenjamin Holzman <bah@ecnvantage.com>2006-07-19 03:11:09 -0400
committerH.Merijn Brand <h.m.brand@xs4all.nl>2006-11-06 09:43:30 +0000
commit8572b25d870f5a82a300ce816436b52f0f8afb0a (patch)
tree5b8af110b4d2e7e843e45f9f5b7e771b039847fe /t/op/time.t
parent296c5fee961dc8807527de4ac3a8363d8cea1a10 (diff)
downloadperl-8572b25d870f5a82a300ce816436b52f0f8afb0a.tar.gz
RE: [perl #26136] localtime(3) calls tzset(3), but localtime_r(3) may not.
From: "Benjamin Holzman" <bholzman@longitude.com> Message-ID: <010801c6ab24$09b9ed30$ce0515ac@office.iseoptions.com> p4raw-id: //depot/perl@29209
Diffstat (limited to 't/op/time.t')
-rwxr-xr-xt/op/time.t11
1 files changed, 9 insertions, 2 deletions
diff --git a/t/op/time.t b/t/op/time.t
index fc73a7bf68..2f01c7ac91 100755
--- a/t/op/time.t
+++ b/t/op/time.t
@@ -1,10 +1,10 @@
#!./perl
if ( $does_gmtime = gmtime(time) ) {
- print "1..7\n"
+ print "1..8\n"
}
else {
- print "1..4\n"
+ print "1..5\n"
}
@@ -52,6 +52,13 @@ ok(localtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ]
'localtime(), scalar context'
);
+# check that localtime respects changes to $ENV{TZ}
+$ENV{TZ} = "GMT-5";
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($beg);
+$ENV{TZ} = "GMT+5";
+($sec,$min,$hour2,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($beg);
+ok($hour != $hour2, 'changes to $ENV{TZ} respected');
+
exit 0 unless $does_gmtime;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($beg);