r50823 - in /trunk/libtime-piece-perl: Changes META.yml Makefile.PL Piece.pm Piece.xs Seconds.pm debian/changelog t/07arith.t

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Tue Jan 12 18:37:18 UTC 2010


Author: jawnsy-guest
Date: Tue Jan 12 18:37:13 2010
New Revision: 50823

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50823
Log:
New upstream release

Modified:
    trunk/libtime-piece-perl/Changes
    trunk/libtime-piece-perl/META.yml
    trunk/libtime-piece-perl/Makefile.PL
    trunk/libtime-piece-perl/Piece.pm
    trunk/libtime-piece-perl/Piece.xs
    trunk/libtime-piece-perl/Seconds.pm
    trunk/libtime-piece-perl/debian/changelog
    trunk/libtime-piece-perl/t/07arith.t

Modified: trunk/libtime-piece-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Changes?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Changes (original)
+++ trunk/libtime-piece-perl/Changes Tue Jan 12 18:37:13 2010
@@ -1,6 +1,19 @@
 
 Time::Piece Changes
 
+1.16
+	- Implement %z for the internal implementation of strptime(). 
+	  Unfortunately this doesn't get picked up everywhere, so there are no 
+	  tests for it (yet - patches welcome).
+	- Fix for major bug in add_months() using negative months which were 
+	  multiples of 12. Also affected add_years() with negative years.
+	- Fix for object creation bug in get_epochs which called new from object 
+	  but that wasn't supported in the new() code.
+ 	- Added docs about the weakness of using epoch seconds internally and
+	  suggested alternatives.
+	- Removed useless "use UNIVERSAL qw(isa)" line.
+	- Fix for installing over core perl version.
+	
 1.15
     - Skip a test on Win32 that there's just no way of passing
     - Document the above failure

Modified: trunk/libtime-piece-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/META.yml?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/META.yml (original)
+++ trunk/libtime-piece-perl/META.yml Tue Jan 12 18:37:13 2010
@@ -1,19 +1,13 @@
 --- #YAML:1.0
-name:               Time-Piece
-version:            1.15
-abstract:           Object Oriented time objects
-author:
+name:                Time-Piece
+version:             1.16
+abstract:            Object Oriented time objects
+license:             ~
+author:              
     - Matt Sergeant
-license:            unknown
-distribution_type:  module
-configure_requires:
-    ExtUtils::MakeMaker:  0
-requires:  {}
-no_index:
-    directory:
-        - t
-        - inc
-generated_by:       ExtUtils::MakeMaker version 6.48
+generated_by:        ExtUtils::MakeMaker version 6.42
+distribution_type:   module
+requires:     
 meta-spec:
-    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
-    version:  1.4
+    url:     http://module-build.sourceforge.net/META-spec-v1.3.html
+    version: 1.3

Modified: trunk/libtime-piece-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Makefile.PL?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Makefile.PL (original)
+++ trunk/libtime-piece-perl/Makefile.PL Tue Jan 12 18:37:13 2010
@@ -7,4 +7,5 @@
     'VERSION_FROM' => 'Piece.pm', # finds $VERSION
     'AUTHOR' => 'Matt Sergeant',
     'ABSTRACT_FROM' => 'Piece.pm',
+    'INSTALLDIRS' => ( $] >= 5.009005 ? 'perl' : 'site' ),
 );

Modified: trunk/libtime-piece-perl/Piece.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Piece.pm?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Piece.pm (original)
+++ trunk/libtime-piece-perl/Piece.pm Tue Jan 12 18:37:13 2010
@@ -1,4 +1,4 @@
-# $Id: Piece.pm 82 2009-06-27 13:20:23Z matt $
+# $Id: Piece.pm 90 2010-01-11 21:02:28Z matt $
 
 package Time::Piece;
 
@@ -9,7 +9,6 @@
 use Time::Seconds;
 use Carp;
 use Time::Local;
-use UNIVERSAL qw(isa);
 
 our @ISA = qw(Exporter DynaLoader);
 
@@ -22,7 +21,7 @@
     ':override' => 'internal',
     );
 
-our $VERSION = '1.15';
+our $VERSION = '1.16';
 
 bootstrap Time::Piece $VERSION;
 
@@ -78,7 +77,7 @@
         $self = $class->localtime();
     }
     
-    return bless $self, $class;
+    return bless $self, ref($class) || $class;
 }
 
 sub parse {
@@ -102,7 +101,7 @@
            : $class;
     if (ref($time)) {
         $time->[c_epoch] = undef;
-        return wantarray ? @$time : bless [@$time, $islocal], $class;
+        return wantarray ? @$time : bless [@$time[0..9], $islocal], $class;
     }
     _tzset();
     my @time = $islocal ?
@@ -601,7 +600,12 @@
     if ($final_month > 11 || $final_month < 0) {
         # these two ops required because we have no POSIX::floor and don't
         # want to load POSIX.pm
-        $num_years = int($final_month / 12);
+        if ($final_month < 0 && $final_month % 12 == 0) {
+            $num_years = int($final_month / 12) + 1;
+        }
+        else {
+            $num_years = int($final_month / 12);
+        }
         $num_years-- if ($final_month < 0);
         
         $final_month = $final_month % 12;
@@ -609,7 +613,7 @@
     
     my @vals = _mini_mktime($time->sec, $time->min, $time->hour,
                             $time->mday, $final_month, $time->year - 1900 + $num_years);
-#    warn(sprintf("got vals: %d-%d-%d %d:%d:%d\n", reverse(@vals)));
+    # warn(sprintf("got %d vals: %d-%d-%d %d:%d:%d [%d]\n", scalar(@vals), reverse(@vals), $time->[c_islocal]));
     return scalar $time->_mktime(\@vals, $time->[c_islocal]);
 }
 
@@ -838,6 +842,17 @@
 Furthermore, remember that this caveat also applies to fork(), which is
 emulated by threads on Win32.
 
+=head2 Use of epoch seconds
+
+This module internally uses the epoch seconds system that is provided via
+the perl C<time()> function and supported by C<gmtime()> and C<localtime()>.
+
+If your perl does not support times larger than C<2^31> seconds then this
+module is likely to fail at processing dates beyond the year 2038. There are
+moves afoot to fix that in perl. Alternatively use 64 bit perl. Or if none
+of those are options, use the L<DateTime> module which has support for years
+well into the future and past.
+
 =head1 AUTHOR
 
 Matt Sergeant, matt at sergeant.org

Modified: trunk/libtime-piece-perl/Piece.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Piece.xs?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Piece.xs (original)
+++ trunk/libtime-piece-perl/Piece.xs Tue Jan 12 18:37:13 2010
@@ -887,6 +887,34 @@
 			}
 			}
 			break;
+
+		case 'z':
+			{
+			int sign = 1;
+
+			if (*buf != '+') {
+				if (*buf == '-')
+					sign = -1;
+				else
+					return 0;
+			}
+
+			buf++;
+			i = 0;
+			for (len = 4; len > 0; len--) {
+				if (isdigit((int)*buf)) {
+					i *= 10;
+					i += *buf - '0';
+					buf++;
+				} else
+					return 0;
+			}
+
+			tm->tm_hour -= sign * (i / 100);
+			tm->tm_min  -= sign * (i % 100);
+			got_GMT = 1;
+			}
+			break;
 		}
 	}
 	return (char *)buf;

Modified: trunk/libtime-piece-perl/Seconds.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/Seconds.pm?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/Seconds.pm (original)
+++ trunk/libtime-piece-perl/Seconds.pm Tue Jan 12 18:37:13 2010
@@ -1,4 +1,4 @@
-# $Id: Seconds.pm 44 2002-09-08 20:51:38Z matt $
+# $Id: Seconds.pm 69 2006-09-07 17:41:05Z matt $
 
 package Time::Seconds;
 use strict;

Modified: trunk/libtime-piece-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/debian/changelog?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/debian/changelog (original)
+++ trunk/libtime-piece-perl/debian/changelog Tue Jan 12 18:37:13 2010
@@ -1,8 +1,12 @@
-libtime-piece-perl (1.15-2) UNRELEASED; urgency=low
+libtime-piece-perl (1.16-1) UNRELEASED; urgency=low
 
+  [ Jonathan Yu ]
+  * New upstream release
+
+  [ Ryan Niebur ]
   * Update ryan52's email address
 
- -- Ryan Niebur <ryan at debian.org>  Fri, 25 Sep 2009 00:26:50 -0700
+ -- Jonathan Yu <jawnsy at cpan.org>  Tue, 12 Jan 2010 13:39:09 -0500
 
 libtime-piece-perl (1.15-1) unstable; urgency=low
 

Modified: trunk/libtime-piece-perl/t/07arith.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libtime-piece-perl/t/07arith.t?rev=50823&op=diff
==============================================================================
--- trunk/libtime-piece-perl/t/07arith.t (original)
+++ trunk/libtime-piece-perl/t/07arith.t Tue Jan 12 18:37:13 2010
@@ -1,4 +1,4 @@
-use Test::More tests => 13;
+use Test::More tests => 25;
 
 BEGIN { use_ok('Time::Piece'); }
 
@@ -24,3 +24,24 @@
 is($t4->year, 2001);
 is($t4->mon, 3);
 is($t4->mday, 1);
+
+$t = Time::Piece->strptime("01 01 2010","%d %m %Y");
+my $t6 = $t->add_months(-12);
+is($t6->year, 2009);
+is($t6->mon, 1);
+is($t6->mday, 1);
+
+my $t7 = $t->add_months(-1);
+is($t7->year, 2009);
+is($t7->mon, 12);
+is($t7->mday, 1);
+
+my $t8 = $t->add_months(-240);
+is($t8->year, 1990);
+is($t8->mon, 1);
+is($t8->mday, 1);
+
+my $t9 = $t->add_months(-13);
+is($t9->year, 2008);
+is($t9->mon, 12);
+is($t9->mday, 1);




More information about the Pkg-perl-cvs-commits mailing list