commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r809090 - /commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c
Date Sat, 29 Aug 2009 07:37:49 GMT
Author: mturk
Date: Sat Aug 29 07:37:49 2009
New Revision: 809090

URL: http://svn.apache.org/viewvc?rev=809090&view=rev
Log:
Use struct tm instead APR expanded time

Modified:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c?rev=809090&r1=809089&r2=809090&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/time.c Sat Aug 29 07:37:49 2009
@@ -52,7 +52,7 @@
     return days * ACR_USEC_PER_SEC;
 }
 
-static void SystemTimeToAprExpTime(struct tm *tm, SYSTEMTIME *st)
+static void SystemTimeToTmTime(struct tm *tm, SYSTEMTIME *st)
 {
     static const int dayoffset[12] =
     { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 };
@@ -90,18 +90,17 @@
 
 ACR_DECLARE(acr_time_t) ACR_Dos2AcrTime(acr_uint32_t t)
 {
-    acr_tm_t     xt;
+    struct tm    tm;
     acr_uint32_t ud = (t >> 16);
 
-    xt.tm_mday = ud & 0x1F;
-    xt.tm_mon  = (acr_uint32_t)(((ud & 0x01E0) / 0x0020) - 1);
-    xt.tm_year = (acr_uint32_t)(((ud & 0xFE00) / 0x0200) + 80);
-    xt.tm_hour = (acr_uint32_t)((t & 0xF800)   / 0x0800);
-    xt.tm_min  = (acr_uint32_t)((t & 0x07E0)   / 0x0020);
-    xt.tm_sec  = (acr_uint32_t)((t & 0x001F) << 1);
-    xt.tm_usec = 0;
+    tm.tm_mday = ud & 0x1F;
+    tm.tm_mon  = (acr_uint32_t)(((ud & 0x01E0) / 0x0020) - 1);
+    tm.tm_year = (acr_uint32_t)(((ud & 0xFE00) / 0x0200) + 80);
+    tm.tm_hour = (acr_uint32_t)((t & 0xF800)   / 0x0800);
+    tm.tm_min  = (acr_uint32_t)((t & 0x07E0)   / 0x0020);
+    tm.tm_sec  = (acr_uint32_t)((t & 0x001F) << 1);
 
-    return tm2time(&xt);
+    return tm2time(&tm);
 }
 
 ACR_DECLARE(acr_uint32_t) ACR_Acr2DosTime(acr_time_t t)
@@ -116,7 +115,7 @@
     /* The Platform SDK documents that SYSTEMTIME/FILETIME are
      * generally UTC, so no timezone info needed
      */
-    SystemTimeToAprExpTime(tm, &st);
+    SystemTimeToTmTime(&tm, &st);
     if (tm.tm_year > 1980)
         tm.tm_year -= 1980;
     else if (tm.tm_year > 80)



Mime
View raw message