summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorH.Merijn Brand <h.m.brand@xs4all.nl>2008-10-18 15:26:02 +0000
committerH.Merijn Brand <h.m.brand@xs4all.nl>2008-10-18 15:26:02 +0000
commit1b289682be66bb0b7b4ce61ed8cef35e32797e7b (patch)
tree96ada759b1e9462c01c4b29dc83531bfb3318fc7 /Configure
parenta65cb92d1f93e8343c90e37bd9d70f91efe34546 (diff)
downloadperl-1b289682be66bb0b7b4ce61ed8cef35e32797e7b.tar.gz
y2038 time checks have overflow checks. Added documentation and
test programs in Porting/ p4raw-id: //depot/perl@34504
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure38
1 files changed, 21 insertions, 17 deletions
diff --git a/Configure b/Configure
index 42baaba36a..0d5412389c 100755
--- a/Configure
+++ b/Configure
@@ -25,7 +25,7 @@
# $Id: Head.U 6 2006-08-25 22:21:46Z rmanfredi $
#
-# Generated on Fri Oct 3 17:54:11 CEST 2008 [metaconfig 3.5 PL0]
+# Generated on Sat Oct 18 17:13:43 CEST 2008 [metaconfig 3.5 PL0]
# (with additional metaconfig patches by perlbug@perl.org)
cat >c1$$ <<EOF
@@ -20069,10 +20069,12 @@ int i;
struct tm *tmp;
time_t pt;
-void gm_check (time_t t)
+void gm_check (time_t t, int min_year, int max_year)
{
tmp = gmtime (&t);
- if (tmp == NULL || tmp->tm_year < -1900)
+ if ( tmp == NULL ||
+ /* Check tm_year overflow */
+ tmp->tm_year < min_year || tmp->tm_year > max_year)
tmp = NULL;
else
pt = t;
@@ -20083,31 +20085,31 @@ int check_max ()
tmp = NULL;
pt = 0;
#ifdef MAXLONG
- gm_check (MAXLONG);
+ gm_check (MAXLONG, 69, 0x7fffffff);
#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);
+ if (x < 0 || x < pt) continue;
+ gm_check (x, 69, 0x7fffffff);
}
}
printf ("sGMTIME_max=%ld\n", pt);
return (0);
- } /* check_max */
+ } /* check_max */
int check_min ()
{
tmp = NULL;
pt = 0;
#ifdef MINLONG
- gm_check (MINLONG);
+ gm_check (MINLONG, -1900, 70);
#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);
+ gm_check (x, -1900, 70);
}
}
printf ("sGMTIME_min=%ld\n", pt);
@@ -20146,13 +20148,15 @@ int i;
struct tm *tmp;
time_t pt;
-void local_check (time_t t)
+void local_check (time_t t, int min_year, int max_year)
{
if (sizeof (time_t) > 4 && t > 0x7ffffffffffff000LL)
tmp = NULL;
else
tmp = localtime (&t);
- if (tmp == NULL || tmp->tm_year < -1900)
+ if ( tmp == NULL ||
+ /* Check tm_year overflow */
+ tmp->tm_year < min_year || tmp->tm_year > max_year)
tmp = NULL;
else
pt = t;
@@ -20163,31 +20167,31 @@ int check_max ()
tmp = NULL;
pt = 0;
#ifdef MAXLONG
- local_check (MAXLONG);
+ local_check (MAXLONG, 69, 0x7fffffff);
#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);
+ if (x < 0 || x < pt) continue;
+ local_check (x, 69, 0x7fffffff);
}
}
printf ("sLOCALTIME_max=%ld\n", pt);
return (0);
- } /* check_max */
+ } /* check_max */
int check_min ()
{
tmp = NULL;
pt = 0;
#ifdef MINLONG
- local_check (MINLONG);
+ local_check (MINLONG, -1900, 70);
#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);
+ local_check (x, -1900, 70);
}
}
printf ("sLOCALTIME_min=%ld\n", pt);