summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.Merijn Brand <h.m.brand@xs4all.nl>2008-07-07 20:03:00 +0000
committerH.Merijn Brand <h.m.brand@xs4all.nl>2008-07-07 20:03:00 +0000
commit81c4fd9ed76693652365ade5cfe1811926de24d8 (patch)
tree789183e2843e4fc18b975d1ba070c1e4d3bc32fc
parent2fd0906e146b3dd212fe42571a111fa13d741cc4 (diff)
downloadperl-81c4fd9ed76693652365ade5cfe1811926de24d8.tar.gz
Part one of y2038 changes for Schwern
p4raw-id: //depot/perl@34105
-rwxr-xr-xConfigure77
-rw-r--r--Porting/Glossary8
-rw-r--r--config_h.SH11
-rw-r--r--handy.h2
4 files changed, 96 insertions, 2 deletions
diff --git a/Configure b/Configure
index 56f4af6e30..bce1daa74d 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$$ <<EOF
@@ -1171,6 +1171,8 @@ stdchar=''
d_stdio_stream_array=''
stdio_stream_array=''
sysman=''
+sGMTIME_max=''
+sGMTIME_min=''
trnl=''
uidformat=''
uidsign=''
@@ -20001,6 +20003,77 @@ else
fi
$rm -f foo* bar*
+: Check the max offset that gmtime accepts
+echo "Checking max offset that gmtime () accepts"
+
+$cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+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 <sys/types.h>
+#include <stdio.h>
+#include <time.h>
+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 af6fa64e41..2773c9490c 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 37fe1e80c9..07f7daac7e 100644
--- a/config_h.SH
+++ b/config_h.SH
@@ -4446,6 +4446,17 @@ sed <<!GROK!THIS! >$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 008141ef3e..8392efc272 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