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_win…
==============================================================================
--- 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