[ros-diffs] [arty] 23646: Fix elrond bug. DNS timeouts now work properly even in the absence of ICMP destination unreachable or a proper response.

arty at svn.reactos.org arty at svn.reactos.org
Tue Aug 22 08:23:01 CEST 2006


Author: arty
Date: Tue Aug 22 10:23:00 2006
New Revision: 23646

URL: http://svn.reactos.org/svn/reactos?rev=23646&view=rev
Log:
Fix elrond bug.  DNS timeouts now work properly even in the absence of ICMP
destination unreachable or a proper response.

Modified:
    trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c

Modified: trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c?rev=23646&r1=23645&r2=23646&view=diff
==============================================================================
--- trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c (original)
+++ trunk/reactos/lib/3rdparty/adns/adns_win32/adns_unix_calls.c Tue Aug 22 10:23:00 2006
@@ -63,30 +63,35 @@
 	return GetCurrentProcessId();
 }
 
+/* ReactOS: Fixed gettimeofday implementation.  Was wrong by a factor of
+ * 10 */
 int gettimeofday(struct timeval *tv, struct timezone *tz)
 {
-	static __int64 Adjustment;
-	__int64 Now = 0;
-       
+    static __int64 Adjustment;
+    __int64 Now = 0;
+    
+    
+    if (!Adjustment)
+    {
+	SYSTEMTIME st = {1970,1,3,0,0,0,0};
 	
-	if (!Adjustment)
-	{ 
-                         SYSTEMTIME st = {1970,1,3,0,0,0,0};       						 
-			 SystemTimeToFileTime(&st, ((LPFILETIME)(VOID *)&Adjustment));
-	}
-	
-	if (tz)
-	{
-		errno = EINVAL;
-		return -1;
-	}
-	
-	GetSystemTimeAsFileTime(((LPFILETIME)(VOID *)&Now));
-	Now -= Adjustment;
-	
-	tv->tv_sec = (long)(Now / 100000000);
-	tv->tv_usec = (long)((Now / 100) - (((__int64)tv->tv_sec * 1000) * 100));
-	return 0;
+	SystemTimeToFileTime(&st, ((LPFILETIME)(VOID *)&Adjustment));
+    }
+    
+    if (tz)
+    {
+	return -1;
+    }
+    
+    GetSystemTimeAsFileTime(((LPFILETIME)(VOID *)&Now));
+    Now -= Adjustment;
+    
+    /* 100 ns
+       .1  us
+       10 * 1000000 */
+    tv->tv_sec = (long)(Now / 10000000);
+    tv->tv_usec = (long)((Now /     10) % 1000000);
+    return 0;
 }
 
 /* Memory allocated in the DLL must be freed in the dll, so




More information about the Ros-diffs mailing list