Win32OperatingSystem.st
changeset 16951 cf9c2837afb8
parent 16948 45832ec999e2
child 17004 504c08a32877
--- a/Win32OperatingSystem.st	Thu Nov 06 23:18:06 2014 +0100
+++ b/Win32OperatingSystem.st	Thu Nov 06 23:49:50 2014 +0100
@@ -623,26 +623,12 @@
     return __get_functionAddress(&libHandle, "ole32.DLL", functionName);
 }
 
-/*
- * The difference between the Windows epoch (1601-01-01 00:00:00)
- * and the Unix epoch (1970-01-01 00:00:00) in seconds is 11644470000 seconds.
-milliseconds is: 11644473600000L
-		 11644470000
- * nov 2014: no longer rebias; return the value as is.
- */
-void
-TimetToFileTime( time_t t, LPFILETIME pft )
-{
-    LONGLONG ll = Int32x32To64(t, 10000000) /* + 116444736000000000 */;
-    pft->dwLowDateTime = (DWORD) ll;
-    pft->dwHighDateTime = ll >>32;
-}
-
 OBJ
 FileTimeToOsTime(LPFILETIME pft)
 {
     LONGLONG lTime = ((LONGLONG)pft->dwHighDateTime << 32) + pft->dwLowDateTime;
-    // lTime = (lTime / 10000) - 11644473600000L;
+    lTime = (lTime / 10000);
+    // lTime = lTime - 11644473600000L;
 
     return(__MKLARGEINT64(1, (unsigned INT)(lTime & 0xFFFFFFFF), (unsigned INT)(lTime >> 32)));
 }
@@ -652,8 +638,11 @@
     UINT low = __longIntVal(tLow);
     UINT hi = __longIntVal(tHigh);
 
-    pft->dwHighDateTime = hi;
-    pft->dwLowDateTime = low;
+    LONGLONG lTime = (((LONGLONG)hi)<<32) + ((LONGLONG)low);
+
+    lTime = (lTime * 10000);
+    pft->dwHighDateTime = (UINT)(lTime >> 32);
+    pft->dwLowDateTime = (UINT)(lTime & 0xFFFFFFFF);
 }
 
 %}
@@ -10513,9 +10502,6 @@
 
     OsTimeToFileTime(tLow, tHigh, &fileTime);
 
-    // t = __longIntVal(osSeconds);
-    // TimetToFileTime((time_t)t, &fileTime);
-
     if (isLocalTime == true) {
 	TIME_ZONE_INFORMATION tzInfo;
 	int tzState;
@@ -17715,15 +17701,15 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.507 2014-11-06 21:20:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.508 2014-11-06 22:49:50 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.507 2014-11-06 21:20:49 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.508 2014-11-06 22:49:50 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Win32OperatingSystem.st,v 1.507 2014-11-06 21:20:49 cg Exp $'
+    ^ '$Id: Win32OperatingSystem.st,v 1.508 2014-11-06 22:49:50 cg Exp $'
 
 ! !