Author: mturk
Date: Sat Aug 29 08:06:06 2009
New Revision: 809094
URL: http://svn.apache.org/viewvc?rev=809094&view=rev
Log:
Use os provided dos time conbersion. TBR
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=809094&r1=809093&r2=809094&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
08:06:06 2009
@@ -88,6 +88,7 @@
return aprtime;
}
+#if 0
ACR_DECLARE(acr_time_t) ACR_Dos2AcrTime(acr_uint32_t t)
{
struct tm tm;
@@ -102,7 +103,24 @@
return tm2time(&tm);
}
+#else
+ACR_DECLARE(acr_time_t) ACR_Dos2AcrTime(acr_uint32_t t)
+{
+ FILETIME ft;
+ WORD dd = (WORD)(t >> 16);
+ WORD dt = (WORD)(t & 0xFFFF);
+ if (DosDateTimeToFileTime(dd, dt, &ft)) {
+ LONGLONG aprtime;
+ FileTimeToUsecTime(&aprtime, &ft);
+ return aprtime;
+ }
+ else
+ return 0;
+}
+#endif
+
+#if 0
ACR_DECLARE(acr_uint32_t) ACR_Acr2DosTime(acr_time_t t)
{
FILETIME ft;
@@ -124,3 +142,17 @@
((tm.tm_sec / 2) + (32 * tm.tm_min) + (2048 * tm.tm_hour));
return rv;
}
+#else
+ACR_DECLARE(acr_uint32_t) ACR_Acr2DosTime(acr_time_t t)
+{
+ FILETIME ft;
+ WORD dd;
+ WORD dt;
+
+ UsecTimeToFileTime(&ft, t);
+ if (FileTimeToDosDateTime(&ft, &dd, &dt))
+ return ((acr_uint32_t)dd << 16) | (acr_uint32_t)dt;
+ else
+ return 0;
+}
+#endif
\ No newline at end of file