Change 33918 by [EMAIL PROTECTED] on 2008/05/24 15:02:06
Subject: Time-Piece-1.13 test failures on HP-UX
From: Gisle Aas <[EMAIL PROTECTED]>
Date: Fri, 23 May 2008 00:20:28 +0200
Message-Id: <[EMAIL PROTECTED]>
Don't rely on strptime being able to parse illegal dates. Also being
tracked
via <http://rt.cpan.org/Public/Bug/Display.html?id=36106> so this also
brings
blead closer to the next (as yet unreleased) version of Time::Piece.
Affected files ...
... //depot/perl/ext/Time/Piece/Piece.pm#19 edit
... //depot/perl/ext/Time/Piece/Piece.xs#16 edit
Differences ...
==== //depot/perl/ext/Time/Piece/Piece.pm#19 (text) ====
Index: perl/ext/Time/Piece/Piece.pm
--- perl/ext/Time/Piece/Piece.pm#18~33469~ 2008-03-10 14:50:24.000000000
-0700
+++ perl/ext/Time/Piece/Piece.pm 2008-05-24 08:02:06.000000000 -0700
@@ -22,7 +22,7 @@
':override' => 'internal',
);
-our $VERSION = '1.13_01';
+our $VERSION = '1.13_02';
bootstrap Time::Piece $VERSION;
@@ -607,12 +607,8 @@
$final_month = $final_month % 12;
}
- my $string = ($time->year + $num_years) . "-" .
- ($final_month + 1) . "-" .
- ($time->mday) . " " . $time->hms;
- my $format = "%Y-%m-%d %H:%M:%S";
- #warn("Parsing string: $string\n");
- my @vals = _strptime($string, $format);
+ 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)));
return scalar $time->_mktime([EMAIL PROTECTED], $time->[c_islocal]);
}
==== //depot/perl/ext/Time/Piece/Piece.xs#16 (text) ====
Index: perl/ext/Time/Piece/Piece.xs
--- perl/ext/Time/Piece/Piece.xs#15~33469~ 2008-03-10 14:50:24.000000000
-0700
+++ perl/ext/Time/Piece/Piece.xs 2008-05-24 08:02:06.000000000 -0700
@@ -914,3 +914,37 @@
PUSHs(sv_2mortal(newSViv(0)));
/* islocal */
PUSHs(sv_2mortal(newSViv(0)));
+
+void
+_mini_mktime(int sec, int min, int hour, int mday, int mon, int year)
+ PREINIT:
+ struct tm mytm;
+ time_t t;
+ PPCODE:
+ t = 0;
+ mytm = *gmtime(&t);
+
+ mytm.tm_sec = sec;
+ mytm.tm_min = min;
+ mytm.tm_hour = hour;
+ mytm.tm_mday = mday;
+ mytm.tm_mon = mon;
+ mytm.tm_year = year;
+
+ my_mini_mktime(&mytm);
+
+ EXTEND(SP, 11);
+ PUSHs(sv_2mortal(newSViv(mytm.tm_sec)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_min)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_hour)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_mday)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_mon)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_year)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_wday)));
+ PUSHs(sv_2mortal(newSViv(mytm.tm_yday)));
+ /* isdst */
+ PUSHs(sv_2mortal(newSViv(0)));
+ /* epoch */
+ PUSHs(sv_2mortal(newSViv(0)));
+ /* islocal */
+ PUSHs(sv_2mortal(newSViv(0)));
End of Patch.