diff options
author | Steve Hay <SteveHay@planit.com> | 2009-05-12 18:02:15 +0100 |
---|---|---|
committer | Steve Hay <SteveHay@planit.com> | 2009-05-12 18:02:15 +0100 |
commit | 8177d4d97c5035e1ca045371b1be47a2ef66ec1d (patch) | |
tree | 4707ff73a35284879d2fbb153cf9c5b9e5168e33 /ext/Time-Piece | |
parent | 5f320ac74440f7b17e30890d0ed2c920d7301549 (diff) | |
download | perl-8177d4d97c5035e1ca045371b1be47a2ef66ec1d.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.
Diffstat (limited to 'ext/Time-Piece')
-rw-r--r-- | ext/Time-Piece/Piece.pm | 5 | ||||
-rw-r--r-- | ext/Time-Piece/t/02core.t | 8 |
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; |