You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/08/29 18:34:43 UTC

svn commit: r809155 - in /commons/sandbox/runtime/trunk/src/main/native: os/unix/time.c test/testsuite.c

Author: mturk
Date: Sat Aug 29 16:34:43 2009
New Revision: 809155

URL: http://svn.apache.org/viewvc?rev=809155&view=rev
Log:
Guard against invalid times

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/unix/time.c
    commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/unix/time.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/unix/time.c?rev=809155&r1=809154&r2=809155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/unix/time.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/unix/time.c Sat Aug 29 16:34:43 2009
@@ -94,7 +94,7 @@
         tm.tm_year -= 1900;
     if (tm.tm_year < 80) {
         /* January 1st 1980 is the
-         * minimum data DOS format can handle.
+         * minimum date DOS format can handle.
          */
         return 0x00210000;
     }

Modified: commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c?rev=809155&r1=809154&r2=809155&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/test/testsuite.c Sat Aug 29 16:34:43 2009
@@ -412,6 +412,7 @@
  */
 static acr_time_t test_2002 = ACR_INT64_C(1032030336186711);
 static acr_time_t test_1980 = ACR_INT64_C(315532800000000);
+static acr_time_t test_2107 = ACR_INT64_C(4403030400000000);
 static int test_times(int argc, const char *const argv[])
 {
     int failed = 0;
@@ -442,6 +443,11 @@
     printf("Acr Time 0 is %" ACR_INT64_T_FMT "\n", ACR_Dos2AcrTime(d2));
     printf("Acr Time 0 is %" ACR_INT64_T_FMT "\n", ACR_Dos2AcrTime(d2+1));
 
+    d2 = ACR_Acr2DosTime(test_2107);
+    printf("Dos Time 2 is %04x - %04x\n",  d2 >> 16, d2 & 0xffff);
+    printf("Acr Time 2 is %" ACR_INT64_T_FMT "\n", ACR_Dos2AcrTime(d2));
+    printf("Acr Time 2 is %" ACR_INT64_T_FMT "\n", ACR_Dos2AcrTime(d2+1));
+
     tests_failed += failed;
     if (failed)
         fprintf(stderr, "times:         Failed (%d)\n", failed);