From: H.Merijn Brand Date: Mon, 15 Sep 2008 08:22:14 +0000 (+0000) Subject: Add probes for LOCALTIME_max and LOCALTIME_min (y2038 project) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=73e6e416ba5c167dc94e3d9723be81ed2dff177b;p=p5sagit%2Fp5-mst-13.2.git Add probes for LOCALTIME_max and LOCALTIME_min (y2038 project) p4raw-id: //depot/perl@34363 --- diff --git a/Configure b/Configure index 1194303..29604dd 100755 --- a/Configure +++ b/Configure @@ -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$$ <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 < +#include +#include +$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' diff --git a/Porting/Glossary b/Porting/Glossary index 337e27e..b481b3b 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -4480,6 +4480,14 @@ sleep (Loc.U): This variable is defined but not used by Configure. The value is a plain '' and is not useful. +sLOCALTIME_max (time_size.U): + This variable defines the maximum value of the time_t offset that + the system function localtime () accepts + +sLOCALTIME_min (time_size.U): + This variable defines the minimum value of the time_t offset that + the system function localtime () accepts + smail (Loc.U): This variable is defined but not used by Configure. The value is a plain '' and is not useful. diff --git a/config_h.SH b/config_h.SH index 7ee3c4f..fb105b7 100644 --- a/config_h.SH +++ b/config_h.SH @@ -2762,6 +2762,12 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #define Sock_size_t $socksizetype /**/ +/* STDCHAR: + * This symbol is defined to be the type of char used in stdio.h. + * It has the values "unsigned char" or "char". + */ +#define STDCHAR $stdchar /**/ + /* Uid_t_f: * This symbol defines the format string used for printing a Uid_t. */ @@ -3270,12 +3276,6 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$ebcdic EBCDIC /**/ -/* STDCHAR: - * This symbol is defined to be the type of char used in stdio.h. - * It has the values "unsigned char" or "char". - */ -#define STDCHAR $stdchar /**/ - /* HAS_ATOLF: * This symbol, if defined, indicates that the atolf routine is * available to convert strings into long doubles. @@ -4460,8 +4460,18 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un * 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 /**/ +/* LOCALTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +#define GMTIME_MAX $sGMTIME_max /**/ +#define GMTIME_MIN $sGMTIME_min /**/ +#define LOCALTIME_MAX $sLOCALTIME_max /**/ +#define LOCALTIME_MIN $sLOCALTIME_min /**/ /* USE_64_BIT_INT: * This symbol, if defined, indicates that 64-bit integers should diff --git a/handy.h b/handy.h index 1c8f8f4..e37b917 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) && defined(GMTIME_MAX) && defined(GMTIME_MIN) && defined(HAS_TIMEGM) +#if defined(LOCALTIME_R_NEEDS_TZSET) && defined(HAS_PSEUDOFORK) && defined(USE_DTRACE) && defined(GMTIME_MAX) && defined(GMTIME_MIN) && defined(LOCALTIME_MAX) && defined(LOCALTIME_MIN) && defined(HAS_TIMEGM) /* Not (yet) used at top level, but mention them for metaconfig */ #endif diff --git a/uconfig.sh b/uconfig.sh index 6bad5e0..4222330 100755 --- a/uconfig.sh +++ b/uconfig.sh @@ -667,18 +667,22 @@ randseedtype='int' rd_nodata='-1' readdir64_r_proto='0' readdir_r_proto='0' -sPRIEUldbl='"llE"' -sPRIFUldbl='"llF"' -sPRIGUldbl='"llG"' -sPRIXU64='"LX"' +sGMTIME_max='2147483647' +sGMTIME_min='0' +sLOCALTIME_max='2147483647' +sLOCALTIME_min='0' sPRId64='"Ld"' sPRIeldbl='"lle"' +sPRIEUldbl='"llE"' sPRIfldbl='"llf"' +sPRIFUldbl='"llF"' sPRIgldbl='"llg"' +sPRIGUldbl='"llG"' sPRIi64='"Li"' sPRIo64='"Lo"' sPRIu64='"Lu"' sPRIx64='"Lx"' +sPRIXU64='"LX"' sSCNfldbl='"llf"' sched_yield='sched_yield()' scriptdir='/usr/local/bin' diff --git a/win32/config.bc b/win32/config.bc index c857637..9ad9c97 100644 --- a/win32/config.bc +++ b/win32/config.bc @@ -862,6 +862,8 @@ run='' runnm='true' sGMTIME_max="2147483647" sGMTIME_min="-2147483648" +sLOCALTIME_max="2147483647" +sLOCALTIME_min="-2147483648" sPRIEUldbl='"E"' sPRIFUldbl='"F"' sPRIGUldbl='"G"' diff --git a/win32/config.gc b/win32/config.gc index 9cb80b2..5c269dc 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -862,6 +862,8 @@ run='' runnm='true' sGMTIME_max="2147483647" sGMTIME_min="0" +sLOCALTIME_max="2147483647" +sLOCALTIME_min="0" sPRIEUldbl='"E"' sPRIFUldbl='"F"' sPRIGUldbl='"G"' diff --git a/win32/config.vc b/win32/config.vc index f91b5b8..3d2ec7e 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -862,6 +862,8 @@ run='' runnm='true' sGMTIME_max="2147483647" sGMTIME_min="0" +sLOCALTIME_max="2147483647" +sLOCALTIME_min="0" sPRIEUldbl='"E"' sPRIFUldbl='"F"' sPRIGUldbl='"G"' diff --git a/win32/config.vc64 b/win32/config.vc64 index 0834ced..05140d6 100644 --- a/win32/config.vc64 +++ b/win32/config.vc64 @@ -862,6 +862,8 @@ run='' runnm='true' sGMTIME_max="2147483647" sGMTIME_min="0" +sLOCALTIME_max="2147483647" +sLOCALTIME_min="0" sPRIEUldbl='"E"' sPRIFUldbl='"F"' sPRIGUldbl='"G"' diff --git a/win32/config_H.bc b/win32/config_H.bc index b32f385..cf11190 100644 --- a/win32/config_H.bc +++ b/win32/config_H.bc @@ -4430,6 +4430,17 @@ #define GMTIME_MAX 2147483647 /**/ #define GMTIME_MIN -2147483648 /**/ +/* LOCALTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +#define LOCALTIME_MAX 2147483647 /**/ +#define LOCALTIME_MIN -2147483648 /**/ + /* 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/win32/config_H.gc b/win32/config_H.gc index 176f136..df197cb 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -4456,6 +4456,17 @@ #define GMTIME_MAX 2147483647 /**/ #define GMTIME_MIN 0 /**/ +/* LOCALTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +#define LOCALTIME_MAX 2147483647 /**/ +#define LOCALTIME_MIN 0 /**/ + /* 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/win32/config_H.vc b/win32/config_H.vc index b2ecc30..53ef9e6 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -4452,6 +4452,17 @@ #define GMTIME_MAX 2147483647 /**/ #define GMTIME_MIN 0 /**/ +/* LOCALTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +#define LOCALTIME_MAX 2147483647 /**/ +#define LOCALTIME_MIN 0 /**/ + /* 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/win32/config_H.vc64 b/win32/config_H.vc64 index 10e40de..699efc2 100644 --- a/win32/config_H.vc64 +++ b/win32/config_H.vc64 @@ -4430,6 +4430,17 @@ #define GMTIME_MAX 2147483647 /**/ #define GMTIME_MIN 0 /**/ +/* LOCALTIME_MAX: + * This symbol contains the maximum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +/* LOCALTIME_MIN: + * This symbol contains the minimum value for the time_t offset that + * the system function localtime () accepts, and defaults to 0 + */ +#define LOCALTIME_MAX 2147483647 /**/ +#define LOCALTIME_MIN 0 /**/ + /* 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/win32/config_sh.PL b/win32/config_sh.PL index 5bd9953..98e158c 100644 --- a/win32/config_sh.PL +++ b/win32/config_sh.PL @@ -138,10 +138,13 @@ if ($opt{cc} eq 'cl' and $opt{ccversion} =~ /^(\d+)/) { my $ccversion = $1; if ($ccversion == 14) { $opt{sGMTIME_max} = 32535244799; + $opt{sLOCALTIME_max} = 32535244799; } elsif ($ccversion >= 15) { $opt{sGMTIME_min} = -43200; $opt{sGMTIME_max} = 32535291599; + $opt{sLOCALTIME_min} = -43200; + $opt{sLOCALTIME_max} = 32535291599; } }