r74787 - in /branches/upstream/libtime-modules-perl/current: CHANGELOG MANIFEST META.yml Makefile.PL lib/Time/CTime.pm lib/Time/DaysInMonth.pm lib/Time/JulianDay.pm lib/Time/ParseDate.pm lib/Time/Timezone.pm t/datetime.t t/metdate.t t/order1.t t/order2.t
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Fri May 20 14:31:12 UTC 2011
Author: gregoa
Date: Fri May 20 14:30:50 2011
New Revision: 74787
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=74787
Log:
[svn-upgrade] new version libtime-modules-perl (2011.0517)
Added:
branches/upstream/libtime-modules-perl/current/t/metdate.t
branches/upstream/libtime-modules-perl/current/t/order1.t
branches/upstream/libtime-modules-perl/current/t/order2.t
Modified:
branches/upstream/libtime-modules-perl/current/CHANGELOG
branches/upstream/libtime-modules-perl/current/MANIFEST
branches/upstream/libtime-modules-perl/current/META.yml
branches/upstream/libtime-modules-perl/current/Makefile.PL
branches/upstream/libtime-modules-perl/current/lib/Time/CTime.pm
branches/upstream/libtime-modules-perl/current/lib/Time/DaysInMonth.pm
branches/upstream/libtime-modules-perl/current/lib/Time/JulianDay.pm
branches/upstream/libtime-modules-perl/current/lib/Time/ParseDate.pm
branches/upstream/libtime-modules-perl/current/lib/Time/Timezone.pm
branches/upstream/libtime-modules-perl/current/t/datetime.t
Modified: branches/upstream/libtime-modules-perl/current/CHANGELOG
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/CHANGELOG?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/CHANGELOG (original)
+++ branches/upstream/libtime-modules-perl/current/CHANGELOG Fri May 20 14:30:50 2011
@@ -1,3 +1,19 @@
+2011.0517:
+ Bugfix from Sophie Hamilton: call tzset() when changing timezones.
+
+ Bugfix: bail out of tests cleanly when tzset doesn't work.
+2011.0505:
+ Bugfix: make sure $ampm is defined so no undefined string warnings
+ are issued.
+
+ Honor the GMT flag when parsing time specs. Patch from
+ kris at shannon.id.au.
+
+ Bugfix: RT#31477 noon & midnight would match in the middle of strings.
+
+ Added %v conversion for Time::CTime
+
+ Added tests to disprove invalid bug reports.
2006.0814:
A bugfix for negative offsets that overflowed (from Vernon Lyon
<vlyon at uk.yahoo-inc.com>)
Modified: branches/upstream/libtime-modules-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/MANIFEST?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/MANIFEST (original)
+++ branches/upstream/libtime-modules-perl/current/MANIFEST Fri May 20 14:30:50 2011
@@ -8,4 +8,7 @@
lib/Time/ParseDate.pm
lib/Time/Timezone.pm
t/datetime.t
+t/metdate.t
+t/order1.t
+t/order2.t
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libtime-modules-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/META.yml?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/META.yml (original)
+++ branches/upstream/libtime-modules-perl/current/META.yml Fri May 20 14:30:50 2011
@@ -1,10 +1,23 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: Time-modules
-version: 2006.0814
-version_from: lib/Time/ParseDate.pm
-installdirs: site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.21
+--- #YAML:1.0
+name: Time-modules
+version: 2011.0517
+abstract: Parse and format time values
+author:
+ - David Muir Sharnoff <cpan at dave.sharnoff.org>
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires: {}
+resources:
+ repository: http://github.com/muir/Time-modules
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.56
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/libtime-modules-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/Makefile.PL?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/Makefile.PL (original)
+++ branches/upstream/libtime-modules-perl/current/Makefile.PL Fri May 20 14:30:50 2011
@@ -2,10 +2,20 @@
use ExtUtils::MakeMaker;
WriteMakefile(
- 'VERSION_FROM' => 'lib/Time/ParseDate.pm',
- 'NAME' => 'Time-modules',
- ($] >= 5.005 ?
- ('ABSTRACT' => 'Parse and format time values',
- 'AUTHOR' => 'David Muir Sharnoff <muir at idiom.com>') : ()),
- 'dist' => { COMPRESS=>"gzip", SUFFIX=>"gz" },
- );
+ VERSION_FROM => 'lib/Time/ParseDate.pm',
+ NAME => 'Time-modules',
+ ($] >= 5.005
+ ?
+ (
+ ABSTRACT => 'Parse and format time values',
+ AUTHOR => 'David Muir Sharnoff <cpan at dave.sharnoff.org>',
+ META_MERGE => {
+ resources => {
+ repository => 'http://github.com/muir/Time-modules',
+ },
+ },
+ )
+ : ()
+ ),
+ dist => { COMPRESS=>"gzip", SUFFIX=>"gz" },
+);
Modified: branches/upstream/libtime-modules-perl/current/lib/Time/CTime.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/lib/Time/CTime.pm?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/lib/Time/CTime.pm (original)
+++ branches/upstream/libtime-modules-perl/current/lib/Time/CTime.pm Fri May 20 14:30:50 2011
@@ -16,7 +16,7 @@
use vars qw(@DoW @DayOfWeek @MoY @MonthOfYear %strftime_conversion $VERSION);
use vars qw($template $sec $min $hour $mday $mon $year $wday $yday $isdst);
-$VERSION = 99.06_22_01;
+$VERSION = 2011.0505;
CONFIG: {
@DoW = qw(Sun Mon Tue Wed Thu Fri Sat);
@@ -54,6 +54,7 @@
't', sub { "\t" },
'T', sub { sprintf("%02d:%02d:%02d", $hour, $min, $sec) },
'U', sub { wkyr(0, $wday, $yday) },
+ 'v', sub { sprintf("%2d-%s-%4d", $mday, $MoY[$mon], $year+1900) },
'w', sub { $wday },
'W', sub { wkyr(1, $wday, $yday) },
'y', sub { sprintf("%02d",$year%100) },
@@ -61,6 +62,7 @@
'x', sub { sprintf("%02d/%02d/%02d", $mon + 1, $mday, $year%100) },
'X', sub { sprintf("%02d:%02d:%02d", $hour, $min, $sec) },
'Z', sub { &tz2zone(undef,undef,$isdst) }
+ # z sprintf("%+03d%02d", $offset / 3600, ($offset % 3600)/60);
);
@@ -115,7 +117,7 @@
local ($template, $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = @_;
undef $@;
- $template =~ s/%([%aAbBcdDefFhHIjklmMnopQrRStTUwWxXyYZ])/&{$Time::CTime::strftime_conversion{$1}}()/egs;
+ $template =~ s/%([%aAbBcdDefFhHIjklmMnopQrRStTUvwWxXyYZ])/&{$Time::CTime::strftime_conversion{$1}}()/egs;
die $@ if $@;
return $template;
}
@@ -154,7 +156,7 @@
%j day of the year
%k hour
%l hour, 12 hour clock
- %m month number, starting with 1
+ %m month number, starting with 1, leading 0's
%M minute, leading 0's
%n NEWLINE
%o ornate day of month -- "1st", "2nd", "25th", etc.
@@ -165,6 +167,7 @@
%t TAB
%T time format: 21:05:57
%U week number, Sunday as first day of week
+ %v DD-Mon-Year
%w day of the week, numerically, Sunday == 0
%W week number, Monday as first day of week
%x date format: 11/19/94
@@ -187,14 +190,16 @@
=head1 GENESIS
-Written by David Muir Sharnoff <muir at idiom.com>.
+Written by David Muir Sharnoff <muir at idiom.org>.
The starting point for this package was a posting by
Paul Foley <paul at ascent.com>
=head1 LICENSE
-Copyright (C) 1996-1999 David Muir Sharnoff. License hereby
+Copyright (C) 1996-2010 David Muir Sharnoff.
+Copyright (C) 2011 Google, Inc.
+License hereby
granted for anyone to use, modify or redistribute this module at
-their own risk. Please feed useful changes back to muir at idiom.com.
-
+their own risk. Please feed useful changes back to cpan at dave.sharnoff.org.
+
Modified: branches/upstream/libtime-modules-perl/current/lib/Time/DaysInMonth.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/lib/Time/DaysInMonth.pm?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/lib/Time/DaysInMonth.pm (original)
+++ branches/upstream/libtime-modules-perl/current/lib/Time/DaysInMonth.pm Fri May 20 14:30:50 2011
@@ -68,7 +68,7 @@
=head1 AUTHOR
-David Muir Sharnoff <muir at idiom.com>
+David Muir Sharnoff <muir at idiom.org>
=head1 BUGS
@@ -79,5 +79,5 @@
Copyright (C) 1996-1999 David Muir Sharnoff. License hereby
granted for anyone to use, modify or redistribute this module at
-their own risk. Please feed useful changes back to muir at idiom.com.
+their own risk. Please feed useful changes back to muir at idiom.org.
Modified: branches/upstream/libtime-modules-perl/current/lib/Time/JulianDay.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/lib/Time/JulianDay.pm?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/lib/Time/JulianDay.pm (original)
+++ branches/upstream/libtime-modules-perl/current/lib/Time/JulianDay.pm Fri May 20 14:30:50 2011
@@ -19,7 +19,7 @@
# constants
use vars qw($brit_jd $jd_epoch $jd_epoch_remainder $VERSION);
-$VERSION = 2003.1125;
+$VERSION = 2011.0505;
# calculate the julian day, given $year, $month and $day
sub julian_day
@@ -208,7 +208,7 @@
=head1 GENESIS
-Written by David Muir Sharnoff <muir at idiom.com> with help from
+Written by David Muir Sharnoff <cpan at dave.sharnoff.org> with help from
previous work by
Kurt Jaeger aka PI <zrzr0111 at helpdesk.rus.uni-stuttgart.de>
based on postings from: Ian Miller <ian_m at cix.compulink.co.uk>;
@@ -220,5 +220,5 @@
Copyright (C) 1996-1999 David Muir Sharnoff. License hereby
granted for anyone to use, modify or redistribute this module at
-their own risk. Please feed useful changes back to muir at idiom.com.
-
+their own risk. Please feed useful changes back to cpan at dave.sharnoff.org.
+
Modified: branches/upstream/libtime-modules-perl/current/lib/Time/ParseDate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/lib/Time/ParseDate.pm?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/lib/Time/ParseDate.pm (original)
+++ branches/upstream/libtime-modules-perl/current/lib/Time/ParseDate.pm Fri May 20 14:30:50 2011
@@ -17,7 +17,7 @@
# constants
use vars qw(%mtable %umult %wdays $VERSION);
-$VERSION = 2006.0814;
+$VERSION = 2011.0517;
# globals
use vars qw($debug);
@@ -255,7 +255,9 @@
}
print "relative date\n" if $debug;
- $jd = local_julian_day($now);
+ $jd = $options{GMT}
+ ? gm_julian_day($now)
+ : local_julian_day($now);
print "jd($now) = $jd\n" if $debug;
$jd += $rd;
} else {
@@ -368,8 +370,13 @@
} else {
unless ($options{GMT}) {
if ($options{ZONE}) {
- $tzadj = tz_offset($options{ZONE}, $secs);
+ $tzadj = tz_offset($options{ZONE}, $secs) || 0;
$tzadj = tz_offset($options{ZONE}, $secs-$tzadj);
+ unless (defined($tzadj)) {
+ return (undef, "could not convert '$options{ZONE}' to time offset")
+ if wantarray();
+ return undef;
+ }
print "adjusting secs for $options{ZONE}: $tzadj\n" if $debug;
$secs -= $tzadj;
} else {
@@ -727,18 +734,18 @@
$$sr += $frac;
}
print "S = $$sr\n" if $debug;
- $ampm = $4 || $9 || $11;
+ $ampm = $4 || $9 || $11 || '';
$$tzr = $12;
$$hr += 12 if $ampm and "\U$ampm" eq "PM" && $$hr != 12;
$$hr = 0 if $$hr == 12 && "\U$ampm" eq "AM";
printf "matched at %d, rem = %s.\n", __LINE__, $$tr if $debug;
return 1;
- } elsif ($$tr =~ s#noon(?:\s+|$ )##ix) {
+ } elsif ($$tr =~ s#^noon(?:\s+|$ )##ix) {
# noon
($$hr, $$mr, $$sr) = (12, 0, 0);
printf "matched at %d.\n", __LINE__ if $debug;
return 1;
- } elsif ($$tr =~ s#midnight(?:\s+|$ )##ix) {
+ } elsif ($$tr =~ s#^midnight(?:\s+|$ )##ix) {
# midnight
($$hr, $$mr, $$sr) = (0, 0, 0);
printf "matched at %d.\n", __LINE__ if $debug;
@@ -1275,13 +1282,11 @@
($seconds, $remaining) = parsedate("today is the day");
($seconds, $error) = parsedate("today is", WHOLE=>1);
-=head1 AUTHOR
-
-David Muir Sharnoff <muir at idiom.com>.
-
=head1 LICENSE
-Copyright (C) 1996-2006 David Muir Sharnoff. License hereby
+Copyright (C) 1996-2010 David Muir Sharnoff.
+Copyright (C) 2011 Google, Inc.
+License hereby
granted for anyone to use, modify or redistribute this module at
-their own risk. Please feed useful changes back to muir at idiom.com.
-
+their own risk. Please feed useful changes back to cpan at dave.sharnoff.org.
+
Modified: branches/upstream/libtime-modules-perl/current/lib/Time/Timezone.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/lib/Time/Timezone.pm?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/lib/Time/Timezone.pm (original)
+++ branches/upstream/libtime-modules-perl/current/lib/Time/Timezone.pm Fri May 20 14:30:50 2011
@@ -330,7 +330,7 @@
=head1 AUTHORS
Graham Barr <bodg at tiuk.ti.com>
-David Muir Sharnoff <muir at idiom.com>
+David Muir Sharnoff <muir at idiom.org>
Paul Foley <paul at ascent.com>
=head1 LICENSE
Modified: branches/upstream/libtime-modules-perl/current/t/datetime.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/t/datetime.t?rev=74787&op=diff
==============================================================================
--- branches/upstream/libtime-modules-perl/current/t/datetime.t (original)
+++ branches/upstream/libtime-modules-perl/current/t/datetime.t Fri May 20 14:30:50 2011
@@ -1,6 +1,4 @@
-#!/usr/bin/perl5.00502 -I. -w
-
-# David Muir Sharnoff <muir at idiom.com>
+#!/usr/bin/perl -I. -w
# find out why it died if not running under make
@@ -8,7 +6,7 @@
$Time::ParseDate::debug = $debug;
-BEGIN {
+BEGIN {
$okat = 12;
$ENV{'LANG'} = 'C';
$ENV{'TZ'} = 'PST8PDT';
@@ -42,6 +40,7 @@
't' => "\t",
'T' => "21:05:57",
'U' => "46",
+ 'v' => "19-Nov-1994",
'w' => "6",
'W' => "46",
'x' => "11/19/94",
@@ -289,7 +288,28 @@
1078876800, ['2004-03-10 00:00:00 GMT'],
1081551599, ['-1 second +1 month', NOW => 1078876800, ZONE => 'PDT'],
1081526399, ['-1 second +1 month', NOW => 1078876800, ZONE => 'GMT'],
-
+ 1304661600, ['11pm', NOW => 1304611460],
+ 1304636400, ['11pm', NOW => 1304611460, GMT => 1],
+ 1304557200, ['1am', NOW => 1304611460, GMT => 1],
+ 1246950000, ['2009/7/7'],
+ -1636819200, ['1918/2/18'],
+ 1246950000, ['2009/7/7'],
+ 1256435700, ['2009-10-25 02:55:00', ZONE => 'MET'],
+ 1256439300, ['+ 1 hour', NOW => 1256435700, ZONE => 'MET'],
+ 1256464500, ['2009-10-25 02:55:00', ZONE => 'PDT'],
+ 1256468100, ['+ 1 hour', NOW => 1256464500, ZONE => 'PDT'],
+ 1256468100, ['2009-10-25 02:55:00', ZONE => 'PST'],
+ 1256471700, ['+ 1 hour', NOW => 1256468100, ZONE => 'PST'],
+ [1304622000, 'Foo'], ['12pm Foo', NOW => 1304611460, WHOLE => 0],
+ undef, ['Foo 12pm', NOW => 1304611460, WHOLE => 0],
+ undef, ['Foo noon', NOW => 1304611460, WHOLE => 0],
+ undef, ['Foo midnight', NOW => 1304611460, WHOLE => 0],
+ 1011252345, ['Wed Jan 16 23:25:45 2002'],
+ 1012550400, ['Feb 1', NOW => 1011252345],
+ 1012550400, ['Feb 1', NOW => 1011252345, FUZZY => 1, PREFER_FUTURE => 1],
+ 1012550400, ['2/1/02', NOW => 1011252345, FUZZY => 1, PREFER_FUTURE => 1],
+ 1011247200, ['6am', GMT => 1, NOW => 1011252345],
+ 1256435700, ['2009-10-25 02:55:00', ZONE => 'MEZ'],
);
%tztests = (
@@ -306,29 +326,33 @@
use Time::ParseDate;
use Time::Local;
use Time::Timezone;
-
-my $before_big = $okat-1+scalar(keys %k)+scalar(keys %tztests);
-
-printf "1..%d\n", $before_big + @sdt/2;
-
-$epoch = ($Time::JulianDay::jd_epoch - 2440588) * 86400
- + $Time::JulianDay::jd_epoch_remainder;
-print STDERR "\nEpoch = $epoch\n" if $epoch;
-
-$etime = 785307957.5 - $epoch;
-
- at x = localtime(785307957);
- at y = gmtime(785307957);
+use POSIX qw(tzset);
+
+tzset;
+
+my @x = localtime(785307957);
+my @y = gmtime(785307957);
my $hd = $y[2] - $x[2];
$hd += 24 if $hd < 0;
$hd %= 24;
if ($hd != 8) {
- print STDERR "\nIt seems localtime() does not honor \$ENV{TZ} when set in the test script.\nPlease set the TZ environment variable to PST8PDT and rerun.\n";
+ print "1..0 # Skipped: It seems localtime() does not honor \$ENV{TZ} when set in the test script. Please set the TZ environment variable to PST8PDT and rerun.";
print "hd = $hd, x = @x, y = @y\n" if $debug || -t STDOUT;
- print "not ok 1\n";
-} else {
- print "ok 1\n";
+ exit 0;
}
+
+my $before_big = $okat-1+scalar(keys %k)+scalar(keys %tztests);
+
+printf "1..%d\n", $before_big + scalar(grep(ref($_), @sdt));
+
+print "ok 1\n";
+
+$epoch = ($Time::JulianDay::jd_epoch - 2440588) * 86400
+ + $Time::JulianDay::jd_epoch_remainder;
+print STDERR "\nEpoch = $epoch\n" if $epoch;
+
+$etime = 785307957.5 - $epoch;
+
eval " 1/0; "; # tests a bug in ctime!
$x = ctime($etime);
@@ -383,7 +407,7 @@
$lt[0] += ($etime - int($etime));
foreach $i (sort keys %k) {
$x = strftime("-%$i-", @lt);
- print $x eq "-$k{$i}-" ? "ok $c\n" : "not ok $c\n";
+ print $x eq "-$k{$i}-" ? "ok $c # $i - $k{$i}\n" : "not ok $c # $i - $k{$i}: $x\n";
if ($debug && $x ne "-$k{$i}-") {
print "strftime(\"-%$i-\") = $x.\n\tshould be: $k{$i}.\n";
exit(0);
@@ -401,8 +425,14 @@
$c++;
}
+
while (@sdt) {
$es = shift(@sdt);
+ my $eremaining;
+ if (ref($es)) {
+ $eremaining = $es->[1];
+ $es = $es->[0];
+ }
$es -= $epoch if defined($es);
$ar = shift(@sdt);
$toparse = shift(@$ar);
@@ -411,13 +441,18 @@
$opts{NOW} -= $epoch;
}
$opts{WHOLE} = 1 unless defined $opts{WHOLE};
- $s = parsedate($toparse, %opts);
+ my $remaining;
+ if (defined $eremaining) {
+ ($s, $remaining) = parsedate($toparse, %opts);
+ } else {
+ $s = parsedate($toparse, %opts);
+ }
if (! defined($es) && ! defined($s)) {
- print "ok $c\n";
- } elsif ($es == $s) {
- print "ok $c\n";
+ print "ok $c # $toparse\n";
+ } elsif (defined($es) && defined($s) && $es == $s) {
+ print "ok $c # $toparse\n";
} else {
- print "not ok $c\n";
+ print "not ok $c # $toparse\n";
if (-t STDOUT || $debug) {
if (defined($es)) {
print strftime("Expected($es): %c %Z\n", localtime($es));
@@ -446,5 +481,16 @@
}
}
}
+ if (defined($eremaining)) {
+ $c++;
+ if ($remaining eq $eremaining) {
+ print "ok $c # remaining = '$eremaining'\n";
+ } else {
+ print "not ok $c # remaining = '$eremaining'\n";
+ if (-t STDOUT || $debug) {
+ print "# got '$remaining' instead\n";
+ }
+ }
+ }
$c++;
}
Added: branches/upstream/libtime-modules-perl/current/t/metdate.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/t/metdate.t?rev=74787&op=file
==============================================================================
--- branches/upstream/libtime-modules-perl/current/t/metdate.t (added)
+++ branches/upstream/libtime-modules-perl/current/t/metdate.t Fri May 20 14:30:50 2011
@@ -1,0 +1,72 @@
+#!/usr/bin/perl -I. -w
+
+use strict;
+use warnings;
+use Test::More;
+use Time::ParseDate;
+use Time::CTime;
+use POSIX qw(tzset);
+
+my $finished;
+END { ok($finished, 'finished') if defined $finished }
+
+$ENV{'LANG'} = 'C';
+$ENV{'TZ'} = 'PST8PDT';
+tzset;
+
+my @x = localtime(785307957);
+my @y = gmtime(785307957);
+my $hd = $y[2] - $x[2];
+$hd += 24 if $hd < 0;
+$hd %= 24;
+if ($hd != 8) {
+ import Test::More skip_all => "It seems localtime() does not honor \$ENV{TZ} when set in the test script.";
+ exit 0;
+}
+import Test::More qw(no_plan);
+
+$ENV{'TZ'} = 'MET';
+tzset;
+
+ at x = localtime(785307957);
+ at y = gmtime(785307957);
+$hd = $y[2] - $x[2];
+$hd += 24 if $hd < 0;
+$hd %= 24;
+if ($hd != 23) {
+ print "1..0 # Skipped: It seems localtime() does not honor \$ENV{TZ} when set in the test script.\n";
+ exit 0;
+}
+
+$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")));
+my $lt1 = scalar(localtime($t1));
+
+is($t0, 1256435700, "testing TZ=MET seconds");
+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")));
+my $lp0 = scalar(localtime($p0));
+my $lp1 = scalar(localtime($p1));
+my $lpz0 = strftime("%R %Z",localtime($p0));
+my $lpz1 = strftime("%R %Z",localtime($p1));
+
+is($p0, 1257065700, "testing PST8PDT");
+is($lp0, "Sun Nov 1 01:55:00 2009", "testing PST8PDT localtime");
+is($p1, 1257069300, "testing PST8PDT");
+is($lp1, "Sun Nov 1 01:55:00 2009", "testing PST8PDT localtime");
+is($lpz0, "01:55 PDT", "zone 0");
+is($lpz1, "01:55 PST", "zone 1");
+
+$finished = 1;
+
Added: branches/upstream/libtime-modules-perl/current/t/order1.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/t/order1.t?rev=74787&op=file
==============================================================================
--- branches/upstream/libtime-modules-perl/current/t/order1.t (added)
+++ branches/upstream/libtime-modules-perl/current/t/order1.t Fri May 20 14:30:50 2011
@@ -1,0 +1,33 @@
+#!/usr/bin/perl -I. -w
+
+use strict;
+use warnings;
+use Test::More;
+use Time::ParseDate;
+use POSIX qw(tzset);
+
+my $finished;
+END { ok($finished, 'finished') if defined $finished }
+
+$ENV{'LANG'} = 'C';
+$ENV{'TZ'} = 'PST8PDT';
+tzset;
+
+my @x = localtime(785307957);
+my @y = gmtime(785307957);
+my $hd = $y[2] - $x[2];
+$hd += 24 if $hd < 0;
+$hd %= 24;
+if ($hd != 8) {
+ import Test::More skip_all => "It seems localtime() does not honor \$ENV{TZ} when set in the test script. Please set the TZ environment variable to PST8PDT and rerun.";
+ exit 0;
+}
+import Test::More qw(no_plan);
+
+$finished = 0;
+
+is(parsedate('1918/2/18'), -1636819200, "year 1918");
+is(parsedate('2009/7/7'), 1246950000, "year 2009");
+
+$finished = 1;
+
Added: branches/upstream/libtime-modules-perl/current/t/order2.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libtime-modules-perl/current/t/order2.t?rev=74787&op=file
==============================================================================
--- branches/upstream/libtime-modules-perl/current/t/order2.t (added)
+++ branches/upstream/libtime-modules-perl/current/t/order2.t Fri May 20 14:30:50 2011
@@ -1,0 +1,33 @@
+#!/usr/bin/perl -I. -w
+
+use strict;
+use warnings;
+use Time::ParseDate;
+use Test::More;
+use POSIX qw(tzset);
+
+my $finished;
+END { ok($finished, 'finished') if defined $finished }
+
+$ENV{'LANG'} = 'C';
+$ENV{'TZ'} = 'PST8PDT';
+tzset;
+
+my @x = localtime(785307957);
+my @y = gmtime(785307957);
+my $hd = $y[2] - $x[2];
+$hd += 24 if $hd < 0;
+$hd %= 24;
+if ($hd != 8) {
+ import Test::More skip_all => "It seems localtime() does not honor \$ENV{TZ} when set in the test script. Please set the TZ environment variable to PST8PDT and rerun.";
+ exit 0;
+}
+import Test::More qw(no_plan);
+
+$finished = 0;
+
+is(parsedate('2009/7/7'), 1246950000, "year 2009");
+is(parsedate('1918/2/18'), -1636819200, "year 1918");
+
+$finished = 1;
+
More information about the Pkg-perl-cvs-commits
mailing list