From: Craig A. Berry Date: Sun, 29 Mar 2009 00:12:11 +0000 (-0500) Subject: Make Time::Piece use the init_tm() in util.c, bump to 1.13_03. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4d72fe625ac27cfd63f4ce3816d7b00fbf04ddf;p=p5sagit%2Fp5-mst-13.2.git Make Time::Piece use the init_tm() in util.c, bump to 1.13_03. Jarkko put it there for that purpose back in e72cf795050cdfe9905e00270c38ba2547626581, so we seem to be a little slow noticing. The old broken method for determining whether we need to initialize a tm struct in the absence of HAS_TM_TM_ZONE being available is preserved for Perls prior to 5.8.0. --- diff --git a/ext/Time-Piece/Piece.pm b/ext/Time-Piece/Piece.pm index a739c39..d49d72b 100644 --- a/ext/Time-Piece/Piece.pm +++ b/ext/Time-Piece/Piece.pm @@ -22,7 +22,7 @@ our %EXPORT_TAGS = ( ':override' => 'internal', ); -our $VERSION = '1.13_02'; +our $VERSION = '1.13_03'; bootstrap Time::Piece $VERSION; diff --git a/ext/Time-Piece/Piece.xs b/ext/Time-Piece/Piece.xs index e65f20c..952cfe8 100644 --- a/ext/Time-Piece/Piece.xs +++ b/ext/Time-Piece/Piece.xs @@ -10,7 +10,7 @@ extern "C" { #endif /* XXX struct tm on some systems (SunOS4/BSD) contains extra (non POSIX) - * fields for which we don't have Configure support yet: + * fields for which we don't have Configure support prior to Perl 5.8.0: * char *tm_zone; -- abbreviation of timezone name * long tm_gmtoff; -- offset from GMT in seconds * To workaround core dumps from the uninitialised tm_zone we get the @@ -19,10 +19,11 @@ extern "C" { * localtime(time()). That should give the desired result most of the * time. But probably not always! * - * This is a temporary workaround to be removed once Configure - * support is added and NETaa14816 is considered in full. - * It does not address tzname aspects of NETaa14816. + * This is a vestigial workaround for Perls prior to 5.8.0. We now + * rely on the initialization (still likely a workaround) in util.c. */ +#if !defined(PERL_VERSION) || PERL_VERSION < 8 + #if defined(HAS_GNULIBC) # ifndef STRUCT_TM_HASZONE # define STRUCT_TM_HASZONE @@ -31,6 +32,8 @@ extern "C" { # endif #endif +#endif /* end of pre-5.8 */ + #define DAYS_PER_YEAR 365 #define DAYS_PER_QYEAR (4*DAYS_PER_YEAR+1) #define DAYS_PER_CENT (25*DAYS_PER_QYEAR-1) @@ -45,6 +48,8 @@ extern "C" { /* as used here, the algorithm leaves Sunday as day 1 unless we adjust it */ #define WEEKDAY_BIAS 6 /* (1+6)%7 makes Sunday 0 again */ +#if !defined(PERL_VERSION) || PERL_VERSION < 8 + #ifdef STRUCT_TM_HASZONE static void my_init_tm(struct tm *ptm) /* see mktime, strftime and asctime */ @@ -58,6 +63,11 @@ my_init_tm(struct tm *ptm) /* see mktime, strftime and asctime */ # define my_init_tm(ptm) #endif +#else +/* use core version from util.c in 5.8.0 and later */ +# define my_init_tm init_tm +#endif + /* * my_mini_mktime - normalise struct tm values without the localtime() * semantics (and overhead) of mktime(). Stolen shamelessly from Perl's