From: H.Merijn Brand Date: Mon, 7 Jul 2008 20:03:00 +0000 (+0000) Subject: Part one of y2038 changes for Schwern X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=81c4fd9ed76693652365ade5cfe1811926de24d8;p=p5sagit%2Fp5-mst-13.2.git Part one of y2038 changes for Schwern p4raw-id: //depot/perl@34105 --- diff --git a/Configure b/Configure index 56f4af6..bce1daa 100755 --- a/Configure +++ b/Configure @@ -25,7 +25,7 @@ # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $ # -# Generated on Mon Jun 16 16:07:02 CEST 2008 [metaconfig 3.5 PL0] +# Generated on Mon Jul 7 21:59:59 CEST 2008 [metaconfig 3.5 PL0] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <try.c <<'EOCP' +#include +#include +#include +int main () { + struct tm *tmp; + int i, y = 0; + time_t pt = 0; + + for (i = 0; i < 78; i++) { + time_t t = (1 << i) - 1; + tmp = gmtime (&t); + if (tmp == NULL || tmp->tm_year < y) { + i--; + printf ("%d\n", pt); + return (i); + } + + y = tmp->tm_year; + pt = t; + } + printf ("%d\n", pt); + return (0); + } +EOCP +set try +if eval $compile; then + sGMTIME_max=`$run ./try` +else + echo "Cannot determine sGMTIME_max" + fi +$rm_try + +echo "Checking min offset that gmtime () accepts" + +$cat >try.c <<'EOCP' +#include +#include +#include +int main () { + struct tm *tmp; + int i, y = 70; + time_t pt = 0; + + for (i = 0; i < 78; i++) { + time_t t = - (1 << i); + tmp = gmtime (&t); + if (tmp == NULL || tmp->tm_year > y) { + i--; + printf ("%d\n", pt); + return (i); + } + + y = tmp->tm_year; + pt = t; + } + printf ("%d\n", pt); + return (0); + } +EOCP +set try +if eval $compile; then + sGMTIME_min=`$run ./try` +else + echo "Cannot determine sGMTIME_min" + fi +$rm_try + : check for type of arguments to select. case "$selecttype" in '') case "$d_select" in @@ -22620,6 +22693,8 @@ rm_try='$rm_try' rmail='$rmail' run='$run' runnm='$runnm' +sGMTIME_max='$sGMTIME_max' +sGMTIME_min='$sGMTIME_min' sPRIEUldbl='$sPRIEUldbl' sPRIFUldbl='$sPRIFUldbl' sPRIGUldbl='$sPRIGUldbl' diff --git a/Porting/Glossary b/Porting/Glossary index af6fa64..2773c94 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -4240,6 +4240,14 @@ setservent_r_proto (d_setservent_r.U): REENTRANT_PROTO_T_ABC macros of reentr.h if d_setservent_r is defined. +sGMTIME_max (time_size.U): + This variable defines the maximum value of the time_t offset that + the system function gmtime () accepts + +sGMTIME_min (time_size.U): + This variable defines the minimum value of the time_t offset that + the system function gmtime () accepts + sh (sh.U): This variable contains the full pathname of the shell used on this system to execute Bourne shell scripts. Usually, this will be diff --git a/config_h.SH b/config_h.SH index 37fe1e8..07f7daa 100644 --- a/config_h.SH +++ b/config_h.SH @@ -4446,6 +4446,17 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un #define STDIO_STREAM_ARRAY $stdio_stream_array #endif +/* GMTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function gmtime () accepts, and defaults to 0 + */ +/* GMTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function gmtime () accepts, and defaults to 0 + */ +#define GMTIME_MAX $sGMTIME_max /**/ +#define GMTIME_MIN $sGMTIME_min /**/ + /* USE_64_BIT_INT: * This symbol, if defined, indicates that 64-bit integers should * be used when available. If not defined, the native integers diff --git a/handy.h b/handy.h index 008141e..8392efc 100644 --- a/handy.h +++ b/handy.h @@ -177,7 +177,7 @@ typedef U64TYPE U64; #endif /* HMB H.Merijn Brand - a placeholder for preparing Configure patches */ -#if defined(LOCALTIME_R_NEEDS_TZSET) && defined(HAS_PSEUDOFORK) && defined(USE_DTRACE) +#if defined(LOCALTIME_R_NEEDS_TZSET) && defined(HAS_PSEUDOFORK) && defined(USE_DTRACE) && defined(GMTIME_MAX) && defined(GMTIME_MIN) /* Not (yet) used at top level, but mention them for metaconfig */ #endif