diff options
author | H.Merijn Brand <h.m.brand@xs4all.nl> | 2008-09-15 08:22:14 +0000 |
---|---|---|
committer | H.Merijn Brand <h.m.brand@xs4all.nl> | 2008-09-15 08:22:14 +0000 |
commit | 73e6e416ba5c167dc94e3d9723be81ed2dff177b (patch) | |
tree | 7a49f26fea26b620ef86dad6f1408e0b90f14dfb /Configure | |
parent | 18eb2ade7d6963228a999e9fcbef5366fbbe213a (diff) | |
download | perl-73e6e416ba5c167dc94e3d9723be81ed2dff177b.tar.gz |
Add probes for LOCALTIME_max and LOCALTIME_min (y2038 project)
p4raw-id: //depot/perl@34363
Diffstat (limited to 'Configure')
-rwxr-xr-x | Configure | 145 |
1 files changed, 110 insertions, 35 deletions
@@ -25,7 +25,7 @@ # $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $ # -# Generated on Fri Aug 22 17:08:28 CEST 2008 [metaconfig 3.5 PL0] +# Generated on Mon Sep 15 10:06:16 CEST 2008 [metaconfig 3.5 PL0] # (with additional metaconfig patches by perlbug@perl.org) cat >c1$$ <<EOF @@ -1174,6 +1174,8 @@ stdio_stream_array='' sysman='' sGMTIME_max='' sGMTIME_min='' +sLOCALTIME_max='' +sLOCALTIME_min='' trnl='' uidformat='' uidsign='' @@ -20021,7 +20023,7 @@ $rm -f foo* bar* set values.h i_values eval $inhdr -: Check the max offset that gmtime accepts +: Check the max offset that gmtime and localtime accept echo "Checking max offsets that gmtime () accepts" case $i_values in @@ -20050,57 +20052,128 @@ void gm_check (time_t t) int check_max () { - tmp = NULL; - pt = 0; + tmp = NULL; + pt = 0; #ifdef MAXLONG - gm_check (MAXLONG); + gm_check (MAXLONG); #endif - if (tmp == NULL || tmp->tm_year < 0) { - for (i = 63; i >= 0; i--) { - time_t x = pt | ((time_t)1 << i); - if (x < 0) continue; - gm_check (x); - } - } - printf ("sGMTIME_max=%ld\n", pt); - return (0); - } + if (tmp == NULL || tmp->tm_year < 0) { + for (i = 63; i >= 0; i--) { + time_t x = pt | ((time_t)1 << i); + if (x < 0) continue; + gm_check (x); + } + } + printf ("sGMTIME_max=%ld\n", pt); + return (0); + } /* check_max */ int check_min () { - tmp = NULL; - pt = 0; + tmp = NULL; + pt = 0; #ifdef MINLONG - gm_check (MINLONG); + gm_check (MINLONG); #endif - if (tmp == NULL) { - for (i = 36; i >= 0; i--) { - time_t x = pt - ((time_t)1 << i); - if (x > 0) continue; - gm_check (x); - } - } - printf ("sGMTIME_min=%ld\n", pt); - return (0); - } + if (tmp == NULL) { + for (i = 36; i >= 0; i--) { + time_t x = pt - ((time_t)1 << i); + if (x > 0) continue; + gm_check (x); + } + } + printf ("sGMTIME_min=%ld\n", pt); + return (0); + } /* check_min */ int main (int argc, char *argv[]) { - fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); - check_max (); - check_min (); - return (0); - } /* main */ + fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t)); + check_max (); + check_min (); + return (0); + } /* main */ EOCP set try if eval $compile; then - yyy=`$run ./try` - eval $yyy + eval `$run ./try` else echo "Cannot determine sGMTIME_max and sGMTIME_min." >&4 fi $rm_try +echo "Checking max offsets that localtime () accepts" + +$cat >try.c <<EOCP +#include <sys/types.h> +#include <stdio.h> +#include <time.h> +$yyy + +int i; +struct tm *tmp; +time_t pt; + +void local_check (time_t t) +{ + tmp = localtime (&t); + if (tmp == NULL || tmp->tm_year < -1900) + tmp = NULL; + else + pt = t; + } /* local_check */ + +int check_max () +{ + tmp = NULL; + pt = 0; +#ifdef MAXLONG + local_check (MAXLONG); +#endif + if (tmp == NULL || tmp->tm_year < 0) { + for (i = 63; i >= 0; i--) { + time_t x = pt | ((time_t)1 << i); + if (x < 0) continue; + local_check (x); + } + } + printf ("sLOCALTIME_max=%ld\n", pt); + return (0); + } /* check_max */ + +int check_min () +{ + tmp = NULL; + pt = 0; +#ifdef MINLONG + local_check (MINLONG); +#endif + if (tmp == NULL) { + for (i = 36; i >= 0; i--) { + time_t x = pt - ((time_t)1 << i); + if (x > 0) continue; + local_check (x); + } + } + printf ("sLOCALTIME_min=%ld\n", pt); + return (0); + } /* check_min */ + +int main (int argc, char *argv[]) +{ + check_max (); + check_min (); + return (0); + } /* main */ +EOCP +set try +if eval $compile; then + eval `$run ./try` +else + echo "Cannot determine sLOCALTIME_max and sLOCALTIME_min." >&4 + fi +$rm_try + : check for type of arguments to select. case "$selecttype" in '') case "$d_select" in @@ -22719,6 +22792,8 @@ run='$run' runnm='$runnm' sGMTIME_max='$sGMTIME_max' sGMTIME_min='$sGMTIME_min' +sLOCALTIME_max='$sLOCALTIME_max' +sLOCALTIME_min='$sLOCALTIME_min' sPRIEUldbl='$sPRIEUldbl' sPRIFUldbl='$sPRIFUldbl' sPRIGUldbl='$sPRIGUldbl' |