summaryrefslogtreecommitdiff
path: root/time
diff options
context:
space:
mode:
authorjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-03-25 23:08:23 +0000
committerjorton <jorton@13f79535-47bb-0310-9956-ffa450edef68>2004-03-25 23:08:23 +0000
commitc3da8b59b2241ac249f2e52e06aec980a69769d8 (patch)
tree4ed4995e05b03dd94b92eef31d2d9267363d693d /time
parent17a972f0b36d01c572bf71cce00e0ac0fcbf6986 (diff)
downloadlibapr-c3da8b59b2241ac249f2e52e06aec980a69769d8.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: http://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)