r11232 - in /branches/upstream/libtime-piece-perl/current: Changes META.yml Piece.pm Piece.xs t/02core.t t/06subclass.t
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Sun Dec 16 15:29:05 UTC 2007
Author: gregoa-guest
Date: Sun Dec 16 15:29:05 2007
New Revision: 11232
URL: http://svn.debian.org/wsvn/?sc=1&rev=11232
Log:
[svn-upgrade] Integrating new upstream version, libtime-piece-perl (1.12)
Modified:
branches/upstream/libtime-piece-perl/current/Changes
branches/upstream/libtime-piece-perl/current/META.yml
branches/upstream/libtime-piece-perl/current/Piece.pm
branches/upstream/libtime-piece-perl/current/Piece.xs
branches/upstream/libtime-piece-perl/current/t/02core.t
branches/upstream/libtime-piece-perl/current/t/06subclass.t
Modified: branches/upstream/libtime-piece-perl/current/Changes
URL: http://svn.debian.org/wsvn/branches/upstream/libtime-piece-perl/current/Changes?rev=11232&op=diff
==============================================================================
--- branches/upstream/libtime-piece-perl/current/Changes (original)
+++ branches/upstream/libtime-piece-perl/current/Changes Sun Dec 16 15:29:05 2007
@@ -1,5 +1,9 @@
Time::Piece Changes
+
+1.12
+ - QNX fixes
+ - Merge with perl core version
1.11
- Skip %V test on Win32
Modified: branches/upstream/libtime-piece-perl/current/META.yml
URL: http://svn.debian.org/wsvn/branches/upstream/libtime-piece-perl/current/META.yml?rev=11232&op=diff
==============================================================================
--- branches/upstream/libtime-piece-perl/current/META.yml (original)
+++ branches/upstream/libtime-piece-perl/current/META.yml Sun Dec 16 15:29:05 2007
@@ -1,7 +1,7 @@
# http://module-build.sourceforge.net/META-spec.html
#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
name: Time-Piece
-version: 1.11
+version: 1.12
version_from: Piece.pm
installdirs: site
requires:
Modified: branches/upstream/libtime-piece-perl/current/Piece.pm
URL: http://svn.debian.org/wsvn/branches/upstream/libtime-piece-perl/current/Piece.pm?rev=11232&op=diff
==============================================================================
--- branches/upstream/libtime-piece-perl/current/Piece.pm (original)
+++ branches/upstream/libtime-piece-perl/current/Piece.pm Sun Dec 16 15:29:05 2007
@@ -1,4 +1,4 @@
-# $Id: Piece.pm 70 2006-09-07 17:43:38Z matt $
+# $Id: Piece.pm 72 2007-11-19 01:26:10Z matt $
package Time::Piece;
@@ -22,7 +22,7 @@
':override' => 'internal',
);
-our $VERSION = '1.11';
+our $VERSION = '1.12';
bootstrap Time::Piece $VERSION;
@@ -540,7 +540,17 @@
if (UNIVERSAL::isa($rhs, 'Time::Seconds')) {
$rhs = $rhs->seconds;
}
- die "Can't subtract a date from something!" if shift;
+
+ if (shift)
+ {
+ # SWAPED is set (so someone tried an expression like NOTDATE - DATE).
+ # Imitate Perl's standard behavior and return the result as if the
+ # string $time resolves to was subtracted from NOTDATE. This way,
+ # classes which override this one and which have a stringify function
+ # that resolves to something that looks more like a number don't need
+ # to override this function.
+ return $rhs - "$time";
+ }
if (UNIVERSAL::isa($rhs, 'Time::Piece')) {
return Time::Seconds->new($time->epoch - $rhs->epoch);
Modified: branches/upstream/libtime-piece-perl/current/Piece.xs
URL: http://svn.debian.org/wsvn/branches/upstream/libtime-piece-perl/current/Piece.xs?rev=11232&op=diff
==============================================================================
--- branches/upstream/libtime-piece-perl/current/Piece.xs (original)
+++ branches/upstream/libtime-piece-perl/current/Piece.xs Sun Dec 16 15:29:05 2007
@@ -1,5 +1,5 @@
#ifdef __cplusplus
-#extern "C" {
+extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
@@ -241,9 +241,13 @@
ptm->tm_wday = (jday + WEEKDAY_BIAS) % 7;
}
-#if defined(WIN32) /* No strptime on Win32 */
+#if defined(WIN32) || (defined(__QNX__) && defined(__WATCOMC__)) /* No strptime on Win32 or QNX4 */
#define strncasecmp(x,y,n) strnicmp(x,y,n)
+
+#if defined(WIN32)
#define alloca _alloca
+#endif
+
#include <time.h>
#include <ctype.h>
#include <string.h>
@@ -755,7 +759,7 @@
for (cp = buf; *cp && isupper((unsigned char)*cp); ++cp)
{/*empty*/}
if (cp - buf) {
- zonestr = alloca(cp - buf + 1);
+ zonestr = (char *)alloca(cp - buf + 1);
strncpy(zonestr, buf, cp - buf);
zonestr[cp - buf] = '\0';
tzset();
@@ -799,7 +803,7 @@
PROTOTYPES: ENABLE
-char *
+void
_strftime(fmt, sec, min, hour, mday, mon, year, wday = -1, yday = -1, isdst = -1)
char * fmt
int sec
@@ -886,12 +890,9 @@
char * string
char * format
PREINIT:
- char tmpbuf[128];
struct tm mytm;
time_t t;
char * remainder;
- int len;
- int tzdiff;
PPCODE:
t = 0;
mytm = *gmtime(&t);
Modified: branches/upstream/libtime-piece-perl/current/t/02core.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtime-piece-perl/current/t/02core.t?rev=11232&op=diff
==============================================================================
--- branches/upstream/libtime-piece-perl/current/t/02core.t (original)
+++ branches/upstream/libtime-piece-perl/current/t/02core.t Sun Dec 16 15:29:05 2007
@@ -1,6 +1,7 @@
use Test::More tests => 93;
my $is_win32 = ($^O =~ /Win32/);
+my $is_qnx = ($^O eq 'qnx');
BEGIN { use_ok('Time::Piece'); }
ok(1);
@@ -60,8 +61,12 @@
cmp_ok($t->strftime('%d'), '==', 29);
SKIP: {
- skip "can't strftime %D, %R, %T or %e on Win32", 2 if $is_win32;
+ skip "can't strftime %D, %R, %T or %e on Win32", 1 if $is_win32;
cmp_ok($t->strftime('%D'), 'eq', '02/29/00'); # Yech!
+}
+SKIP:{
+ skip "can't strftime %D, %R, %T or %e on Win32", 1 if $is_win32;
+ skip "can't strftime %e on QNX", 1 if $is_qnx;
cmp_ok($t->strftime('%e'), 'eq', '29'); # should test with < 10
}
@@ -76,7 +81,7 @@
# and are possibly unportable (am or AM or a.m., and so on)
SKIP: {
- skip "can't strftime %R on Win32", 1 if $is_win32;
+ skip "can't strftime %R on Win32 or QNX", 1 if $is_win32 or $is_qnx;
cmp_ok($t->strftime('%R'), 'eq', '12:34'); # should test with > 12
}
@@ -94,7 +99,7 @@
cmp_ok($t->strftime('%U'), 'eq', '09'); # Sun cmp Mon
SKIP: {
- skip "can't strftime %V on Win32", 1 if $is_win32;
+ skip "can't strftime %V on Win32 or QNX", 1 if $is_win32 or $is_qnx;
# is this test really broken on Mac OS? -- rjbs, 2006-02-08
cmp_ok($t->strftime('%V'), 'eq', '09'); # Sun cmp Mon
}
Modified: branches/upstream/libtime-piece-perl/current/t/06subclass.t
URL: http://svn.debian.org/wsvn/branches/upstream/libtime-piece-perl/current/t/06subclass.t?rev=11232&op=diff
==============================================================================
--- branches/upstream/libtime-piece-perl/current/t/06subclass.t (original)
+++ branches/upstream/libtime-piece-perl/current/t/06subclass.t Sun Dec 16 15:29:05 2007
@@ -45,3 +45,22 @@
use base qw(Time::Piece);
# this package is identical, but will be ->isa('Time::Piece::Twin');
}
+
+{
+ my $class = "Time::Piece::NumString";
+ my $piece = $class->strptime ("2006", "%Y");
+ is (2007 - $piece, 1,
+ "subtract attempts stringify for unrecognized objects.");
+}
+
+## Below is a package which only changes the stringify function.
+{
+ package Time::Piece::NumString;
+ use base qw(Time::Piece);
+ use overload '""' => \&_stringify;
+ sub _stringify
+ {
+ my $self = shift;
+ return $self->strftime ("%Y");
+ }
+}
More information about the Pkg-perl-cvs-commits
mailing list