summaryrefslogtreecommitdiff
path: root/windows_port.c
diff options
context:
space:
mode:
authorGisle Vanem <gvanem@broadpark.no>2004-11-10 14:23:20 +0000
committerGisle Vanem <gvanem@broadpark.no>2004-11-10 14:23:20 +0000
commit6c64cc8669d74d097a6d090a0f82a528bfba7f77 (patch)
tree62f80a4a085de2e0a502dcdfc7b38fbcf5af3a31 /windows_port.c
parenteadf3e7f0dad52d6a13b1e8615ec110434380236 (diff)
downloadc-ares-6c64cc8669d74d097a6d090a0f82a528bfba7f77.tar.gz
c-ares-6c64cc8669d74d097a6d090a0f82a528bfba7f77.tar.bz2
c-ares-6c64cc8669d74d097a6d090a0f82a528bfba7f77.zip
Replace IsNT with IS_NT().
Return correct timeval in windows_port.c. Squelch gcc warnings: use 'ares_socket_t' in ares_fds.c. Don't cast a 'lvalue' in ares_init.c.
Diffstat (limited to 'windows_port.c')
-rw-r--r--windows_port.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/windows_port.c b/windows_port.c
index 9aa72fa..e80d00d 100644
--- a/windows_port.c
+++ b/windows_port.c
@@ -39,28 +39,34 @@ ares_strcasecmp(const char *a, const char *b)
}
#endif
+/*
+ * Number of micro-seconds between the beginning of the Windows epoch
+ * (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970).
+ */
+#if defined(_MSC_VER) || defined(__WATCOMC__)
+#define EPOCH_FILETIME 11644473600000000Ui64
+#else
+#define EPOCH_FILETIME 11644473600000000ULL
+#endif
+
int
ares_gettimeofday(struct timeval *tv, struct timezone *tz)
{
FILETIME ft;
LARGE_INTEGER li;
__int64 t;
- static int tzflag;
if (tv)
{
GetSystemTimeAsFileTime(&ft);
li.LowPart = ft.dwLowDateTime;
li.HighPart = ft.dwHighDateTime;
- t = li.QuadPart; /* In 100-nanosecond intervals */
-#if 0
- t -= EPOCHFILETIME; /* Offset to the Epoch time */
-#endif
- t /= 10; /* In microseconds */
+ t = li.QuadPart / 10; /* In micro-second intervals */
+ t -= EPOCH_FILETIME; /* Offset to the Epoch time */
tv->tv_sec = (long)(t / 1000000);
tv->tv_usec = (long)(t % 1000000);
}
-
+ (void) tz;
return 0;
}