summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorSteve Hay <SteveHay@planit.com>2009-05-12 18:02:15 +0100
committerDavid Mitchell <davem@iabyn.com>2009-06-28 01:11:57 +0100
commit3d8a28112a518c2fcc325000e4eeb69047bd3939 (patch)
treef430f98af9ef3b90e6fc62dcc2e695e9bc4a22d4 /ext
parent805bfd4594b009b6725de7d8a60f08fcee345c18 (diff)
downloadperl-3d8a28112a518c2fcc325000e4eeb69047bd3939.tar.gz
Skip test for changing TZ if running in a pseudo-fork (on Win32)
Changing $ENV{TZ} and calling tzset() is documented not to work on Win32 in any thread other than the main thread, which includes the emulated fork() on Win32 (used by cpantesters?). Mention fork() in the caveats and skip the test in this case. (cherry picked from commit 8177d4d97c5035e1ca045371b1be47a2ef66ec1d)
Diffstat (limited to 'ext')
-rw-r--r--ext/Time-Piece/Piece.pm5
-rw-r--r--ext/Time-Piece/t/02core.t8
2 files changed, 11 insertions, 2 deletions
diff --git a/ext/Time-Piece/Piece.pm b/ext/Time-Piece/Piece.pm
index abdf588af4..302114f392 100644
--- a/ext/Time-Piece/Piece.pm
+++ b/ext/Time-Piece/Piece.pm
@@ -22,7 +22,7 @@ our %EXPORT_TAGS = (
':override' => 'internal',
);
-our $VERSION = '1.14';
+our $VERSION = '1.14_01';
bootstrap Time::Piece $VERSION;
@@ -835,6 +835,9 @@ subsequently call that with the %Z formatting code. You must change $ENV{TZ}
in the main thread to have the desired effect in this case (and you must
also call _tzset() in the main thread to register the environment change).
+Furthermore, remember that this caveat also applies to fork(), which is
+emulated by threads on Win32.
+
=head1 AUTHOR
Matt Sergeant, matt@sergeant.org
diff --git a/ext/Time-Piece/t/02core.t b/ext/Time-Piece/t/02core.t
index 7ca22a9bb1..5610bcb74d 100644
--- a/ext/Time-Piece/t/02core.t
+++ b/ext/Time-Piece/t/02core.t
@@ -47,7 +47,13 @@ cmp_ok($t->datetime, 'eq','2000-02-29T12:34:56');
cmp_ok($t->daylight_savings, '==', 0);
# ->tzoffset?
-{
+my $is_pseudo_fork = 0;
+if (defined &Win32::GetCurrentProcessId
+ ? $$ != Win32::GetCurrentProcessId() : $^O eq "MSWin32" && $$ < 0) {
+ $is_pseudo_fork = 1;
+}
+SKIP: {
+ skip "can't register TZ changes in a pseudo-fork", 2 if $is_pseudo_fork;
local $ENV{TZ} = "EST5";
Time::Piece::_tzset(); # register the environment change
my $lt = localtime;