diff options
author | SADAHIRO Tomoyuki <BQW10602@nifty.com> | 2006-11-07 08:31:50 +0900 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2006-11-06 14:37:32 +0000 |
commit | a8c5b3ccafcbc15c45c2cc8105bb50368b6a22d6 (patch) | |
tree | c4a5d7ee41c54affe2f80bc3c427a32d7b66024b /t/op/time.t | |
parent | 210ccf0a69ab3f51833a0fadbf3162f5978d6d13 (diff) | |
download | perl-a8c5b3ccafcbc15c45c2cc8105bb50368b6a22d6.tar.gz |
Re: [perl #26136] localtime(3) calls tzset(3), but localtime_r(3) may not.
Message-Id: <20061106233139.A2BC.BQW10602@nifty.com>
p4raw-id: //depot/perl@29215
Diffstat (limited to 't/op/time.t')
-rwxr-xr-x | t/op/time.t | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/t/op/time.t b/t/op/time.t index 2f01c7ac91..330cc86715 100755 --- a/t/op/time.t +++ b/t/op/time.t @@ -1,26 +1,14 @@ #!./perl -if ( $does_gmtime = gmtime(time) ) { - print "1..8\n" -} -else { - print "1..5\n" -} - - -my $test = 1; -sub ok ($$) { - my($ok, $name) = @_; - - # You have to do it this way or VMS will get confused. - print $ok ? "ok $test - $name\n" : "not ok $test - $name\n"; +$does_gmtime = gmtime(time); - printf "# Failed test at line %d\n", (caller)[2] unless $ok; - - $test++; - return $ok; +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + require './test.pl'; } +plan tests => 8; ($beguser,$begsys) = times; @@ -52,14 +40,23 @@ ok(localtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ] 'localtime(), scalar context' ); +SKIP: { + # This conditional of "No tzset()" is stolen from ext/POSIX/t/time.t + skip "No tzset()", 1 + if $^O eq "MacOS" || $^O eq "VMS" || $^O eq "cygwin" || + $^O eq "djgpp" || $^O eq "MSWin32" || $^O eq "dos" || + $^O eq "interix"; + # 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; +SKIP: { + skip "No gmtime()", 3 unless $does_gmtime; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($beg); ($xsec,$foo) = localtime($now); @@ -78,3 +75,4 @@ ok(gmtime() =~ /^(Sun|Mon|Tue|Wed|Thu|Fri|Sat)[ ] /x, 'gmtime(), scalar context' ); +} |