Subject: | strptime for QNX4/watcom |
Date: | Mon, 8 Oct 2007 13:29:21 +0100 |
To: | bug-Time-Piece [...] rt.cpan.org |
From: | Alex Gough <alex [...] earth.li> |
Hello Time::Piece. To get you to build on QNX4 I need
to use the strptime function that win32 uses. Patch against
perl-current.
Thanks,
Alex Gough
----- Forwarded message from Alex Gough <alex-p5p@earth.li> -----
Date: Mon, 8 Oct 2007 13:10:04 +0100
From: Alex Gough <alex-p5p@earth.li>
To: perl5-porters@perl.org
Subject: [PATCH] Time::Piece & matherr on qnx4
Here's the second patch required to get Perl building on QNX4.
The first couple of changes affect Time::Piece, pulling in the
strptime function already written for win32 and skipping some tests.
The second couple of chunks add a matherr callback to silence noise from the
libraries which was making many tests fail incorrectly.
I've not checked that this does still build ok on win32, but it's fine
on my linux system. I've also removed an old version of me from the
AUTHORS file.
diff -urN perl-orig/ext/Time/Piece/Piece.xs perl-current/ext/Time/Piece/Piece.xs
--- perl-orig/ext/Time/Piece/Piece.xs 2007-10-08 11:42:52.000000000 +0000
+++ perl-current/ext/Time/Piece/Piece.xs 2007-10-08 11:45:17.000000000 +0000
@@ -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>
diff -urN perl-orig/ext/Time/Piece/t/02core.t perl-current/ext/Time/Piece/t/02core.t
--- perl-orig/ext/Time/Piece/t/02core.t 2007-10-08 11:42:52.000000000 +0000
+++ perl-current/ext/Time/Piece/t/02core.t 2007-10-08 11:45:40.000000000 +0000
@@ -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
}