]> granicus.if.org Git - libexpat/commitdiff
Use GetSystemTimeAsFileTime on Non-Cygwin-Windows with no gettimeofday
authorSebastian Pipping <sebastian@pipping.org>
Mon, 28 Mar 2016 14:33:49 +0000 (16:33 +0200)
committerSebastian Pipping <sebastian@pipping.org>
Mon, 28 Mar 2016 16:19:02 +0000 (18:19 +0200)
expat/lib/xmlparse.c

index 73dcc7886f7d2c9a2dab5e74c73a64490438e6f2..5fdd79a915e85890ccc935b8753dbe3bee265262 100644 (file)
@@ -695,6 +695,11 @@ static const XML_Char implicitContext[] = {
 static unsigned long
 gather_time_entropy(void)
 {
+#ifdef COMPILING_FOR_WINDOWS
+  FILETIME ft;
+  GetSystemTimeAsFileTime(&ft); /* never fails */
+  return ft.dwHighDateTime ^ ft.dwLowDateTime;
+#else
   struct timeval tv;
   int gettimeofday_res;
 
@@ -703,6 +708,7 @@ gather_time_entropy(void)
 
   /* Microseconds time is <20 bits entropy */
   return tv.tv_usec;
+#endif
 }
 
 static unsigned long