summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.Merijn Brand <h.m.brand@xs4all.nl>2008-09-15 08:22:14 +0000
committerH.Merijn Brand <h.m.brand@xs4all.nl>2008-09-15 08:22:14 +0000
commit73e6e416ba5c167dc94e3d9723be81ed2dff177b (patch)
tree7a49f26fea26b620ef86dad6f1408e0b90f14dfb
parent18eb2ade7d6963228a999e9fcbef5366fbbe213a (diff)
downloadperl-73e6e416ba5c167dc94e3d9723be81ed2dff177b.tar.gz
Add probes for LOCALTIME_max and LOCALTIME_min (y2038 project)
p4raw-id: //depot/perl@34363
-rwxr-xr-xConfigure145
-rw-r--r--Porting/Glossary8
-rw-r--r--config_h.SH26
-rw-r--r--handy.h2
-rwxr-xr-xuconfig.sh12
-rw-r--r--win32/config.bc2
-rw-r--r--win32/config.gc2
-rw-r--r--win32/config.vc2
-rw-r--r--win32/config.vc642
-rw-r--r--win32/config_H.bc11
-rw-r--r--win32/config_H.gc11
-rw-r--r--win32/config_H.vc11
-rw-r--r--win32/config_H.vc6411
-rw-r--r--win32/config_sh.PL3
14 files changed, 200 insertions, 48 deletions
diff --git a/Configure b/Configure
index 1194303a8a..29604dd4e1 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$$ <<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'
diff --git a/Porting/Glossary b/Porting/Glossary
index 337e27e0d2..b481b3b4ff 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 7ee3c4f088..fb105b7b98 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -2762,6 +2762,12 @@ sed <<!GROK!THIS! >$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 <<!GROK!THIS! >$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 <<!GROK!THIS! >$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 1c8f8f4b3b..e37b917ee3 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 6bad5e0c8e..4222330241 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 c857637ba7..9ad9c972c8 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 9cb80b296f..5c269dcbad 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 f91b5b8612..3d2ec7e39f 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 0834ced4e9..05140d6755 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 b32f385d51..cf1119050c 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 176f136cd5..df197cb469 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 b2ecc3068d..53ef9e66fc 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 10e40dea52..699efc2aa6 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 5bd9953a5b..98e158c3c7 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;
}
}