summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorJoe Orton <jorton@apache.org>2004-03-25 23:08:23 +0000
committerJoe Orton <jorton@apache.org>2004-03-25 23:08:23 +0000
commit6e60ed822c0d68a98d10a76ed37cdfb2cb176236 (patch)
tree4ed4995e05b03dd94b92eef31d2d9267363d693d /time
parent0b96a1f02520f4cf30840cdfe09a70c095ea5cfd (diff)
downloadapr-6e60ed822c0d68a98d10a76ed37cdfb2cb176236.tar.gz
* time/unix/time.c (apr_time_exp_get): Remove year check that failed for
2038, use apr_time_t to avoid overflow. * time/win32/time.c (apr_time_exp_get): ditto * test/testtime.c (test_2038): Add regression test. Submitted by: Philip Martin <philip@codematters.co.uk> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65026 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'time')
-rw-r--r--time/unix/time.c9
-rw-r--r--time/win32/time.c10
2 files changed, 4 insertions, 15 deletions
diff --git a/time/unix/time.c b/time/unix/time.c
index 1af56e643..507d71014 100644
--- a/time/unix/time.c
+++ b/time/unix/time.c
@@ -135,16 +135,11 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt)
{
- int year;
- time_t days;
+ apr_time_t year = xt->tm_year;
+ apr_time_t days;
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
- year = xt->tm_year;
- if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) {
- return APR_EBADDATE;
- }
-
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)
diff --git a/time/win32/time.c b/time/win32/time.c
index 59ffcc43e..35743b3d2 100644
--- a/time/win32/time.c
+++ b/time/win32/time.c
@@ -218,17 +218,11 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result,
APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t,
apr_time_exp_t *xt)
{
- int year;
- time_t days;
+ apr_time_t year = xt->tm_year;
+ apr_time_t days;
static const int dayoffset[12] =
{306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
- year = xt->tm_year;
-
- if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138))) {
- return APR_EBADDATE;
- }
-
/* shift new year to 1st March in order to make leap year calc easy */
if (xt->tm_mon < 2)