Skip Menu |

This queue is for tickets about the Time-ParseDate CPAN distribution.

Report information
The Basics
Id: 90367
Status: resolved
Priority: 0/
Queue: Time-ParseDate

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2013.1113
Fixed in: (no value)



Subject: tzset calls in test suite
The test files t/order1.t and t/order2.t check if POSIX::tzset is available by calling it in an eval block. Unfortunately, there's an unprotected tzset() call later in the test files. This causes the test script to fail on systems without tzset() (e.g. on Windows systems using Strawberry Perl). Regards, Slaven
From: matthew.vale [...] tuxtel.net
using POSIX qw(tzset) will not work on some platforms (mostly Win32 in non cygwin) you can use Time::Piece instead which has two benefits It is supported on more platforms it will automatically deal with getting the timezone set because it does itself with calls to localtime and gmtime I have attached a proposed patch for this
Subject: tzset.patch
+++ "/t/datetime.t" @@ -343,9 +343,7 @@ use Time::JulianDay; use Time::ParseDate; use Time::Local; use Time::Timezone; -use POSIX qw(tzset); - -eval { tzset }; # Might not be implemented everywhere +use Time::Piece; my @x = localtime(785307957); my @y = gmtime(785307957); +++ "/t/metdate.t" @@ -5,15 +5,13 @@ use warnings; use Test::More; use Time::ParseDate; use Time::CTime; -use POSIX qw(tzset); +use Time::Piece; my $finished; END { ok($finished, 'finished') if defined $finished } $ENV{'LANG'} = 'C'; $ENV{'TZ'} = 'PST8PDT'; -eval { tzset; 1 } - or plan skip_all => "It seems POSIX::tzset is not available."; my @x = localtime(785307957); my @y = gmtime(785307957); @@ -26,7 +24,6 @@ if ($hd != 8) { } $ENV{'TZ'} = 'MET'; -tzset; @x = localtime(785307957); @y = gmtime(785307957); @@ -42,7 +39,6 @@ plan 'no_plan'; $finished = 0; $ENV{TZ} = 'MET'; -tzset; my $t0 = parsedate("2009-10-25 02:55:00"); my $t1 = parsedate("+ 1 hour", NOW => scalar(parsedate("2009-10-25 02:55:00"))); @@ -53,7 +49,6 @@ is($t1, 1256439300, "testing TZ=MET seconds +1 h"); is($lt1, "Sun Oct 25 03:55:00 2009", "testing TZ=MET +1 h localtime"); $ENV{TZ} = "PST8PDT"; -tzset; my $p0 = parsedate("2009-11-01 01:55:00"); my $p1 = parsedate("+ 1 hour", NOW => scalar(parsedate("2009-11-01 01:55:00"))); +++ "/t/order1.t" @@ -4,14 +4,13 @@ use strict; use warnings; use Test::More; use Time::ParseDate; -use POSIX qw(tzset); +use Time::Piece; my $finished; END { ok($finished, 'finished') if defined $finished } $ENV{'LANG'} = 'C'; $ENV{'TZ'} = 'PST8PDT'; -eval { tzset }; # Might not be implemented everywhere my @x = localtime(785307957); my @y = gmtime(785307957); @@ -30,7 +29,6 @@ is(parsedate('1918/2/18'), -1636819200, "year 1918"); is(parsedate('2009/7/7'), 1246950000, "year 2009"); $ENV{'TZ'} = 'Europe/Moscow'; -tzset; is(parsedate('2009-11-01'), 1257022800, 'Europe/Moscow, DST permanent 2009'); is(parsedate('2013-05-30'), 1369857600, 'Europe/Moscow, DST permanent 2013'); +++ "/t/order2.t" @@ -4,14 +4,13 @@ use strict; use warnings; use Time::ParseDate; use Test::More; -use POSIX qw(tzset); +use Time::Piece; my $finished; END { ok($finished, 'finished') if defined $finished } $ENV{'LANG'} = 'C'; $ENV{'TZ'} = 'PST8PDT'; -eval { tzset }; # Might not be implemented everywhere my @x = localtime(785307957); my @y = gmtime(785307957); @@ -30,7 +29,6 @@ is(parsedate('2009/7/7'), 1246950000, "year 2009"); is(parsedate('1918/2/18'), -1636819200, "year 1918"); $ENV{'TZ'} = 'Europe/Moscow'; -tzset; is(parsedate('2013-05-30'), 1369857600, 'Europe/Moscow, DST permanent 2013'); is(parsedate('2009-11-01'), 1257022800, 'Europe/Moscow, DST permanent 2009');
John Karr pulled in the change, Thanks