summaryrefslogtreecommitdiff
path: root/test/testtime.c
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 /test/testtime.c
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 'test/testtime.c')
-rw-r--r--test/testtime.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/testtime.c b/test/testtime.c
index ab14cdfe3..a84da164c 100644
--- a/test/testtime.c
+++ b/test/testtime.c
@@ -265,6 +265,24 @@ static void test_strftimeoffset(CuTest *tc)
CuAssertTrue(tc, rv == APR_SUCCESS);
}
+/* 0.9.4 and earlier rejected valid dates in 2038 */
+static void test_2038(CuTest *tc)
+{
+ apr_time_exp_t xt;
+ apr_time_t t;
+
+ /* 2038-01-19T03:14:07.000000Z */
+ xt.tm_year = 138;
+ xt.tm_mon = 0;
+ xt.tm_mday = 19;
+ xt.tm_hour = 3;
+ xt.tm_min = 14;
+ xt.tm_sec = 7;
+
+ apr_assert_success(tc, "explode January 19th, 2038",
+ apr_time_exp_get(&t, &xt));
+}
+
CuSuite *testtime(void)
{
CuSuite *suite = CuSuiteNew("Time");
@@ -281,6 +299,7 @@ CuSuite *testtime(void)
SUITE_ADD_TEST(suite, test_strftimesmall);
SUITE_ADD_TEST(suite, test_exp_tz);
SUITE_ADD_TEST(suite, test_strftimeoffset);
+ SUITE_ADD_TEST(suite, test_2038);
return suite;
}