Alexandre Julliard : libport: Avoid issues with struct timeval on Windows.

Alexandre Julliard julliard at winehq.org
Thu Mar 14 18:33:22 CDT 2019


Module: wine
Branch: master
Commit: d45d751d76f18ac25c069bfa787fb3339fb3f073
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=d45d751d76f18ac25c069bfa787fb3339fb3f073

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Mar 14 17:48:51 2019 +0100

libport: Avoid issues with struct timeval on Windows.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 libs/port/mkstemps.c | 12 ++++++++----
 libs/port/poll.c     |  7 +++++++
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/libs/port/mkstemps.c b/libs/port/mkstemps.c
index 5c8c7a3..ba92b2a 100644
--- a/libs/port/mkstemps.c
+++ b/libs/port/mkstemps.c
@@ -65,7 +65,6 @@ mkstemps (
   static const char letters[]
     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
   static unsigned __int64 value;
-  struct timeval tv;
   char *XXXXXX;
   size_t len;
   int count;
@@ -80,9 +79,14 @@ mkstemps (
 
   XXXXXX = &template[len - 6 - suffix_len];
 
-  /* Get some more or less random data.  */
-  gettimeofday (&tv, NULL);
-  value += ((unsigned __int64) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
+#ifndef _WIN32
+  {
+      struct timeval tv;
+      gettimeofday( &tv, NULL );
+      value += ((unsigned __int64) tv.tv_usec << 16) ^ tv.tv_sec;
+  }
+#endif
+  value += getpid();
 
   for (count = 0; count < TMP_MAX; ++count)
     {
diff --git a/libs/port/poll.c b/libs/port/poll.c
index 7ee5852..c499a96 100644
--- a/libs/port/poll.c
+++ b/libs/port/poll.c
@@ -35,6 +35,13 @@
 
 #define FD_SETSIZE 64
 
+struct __ms_timeval
+{
+    long tv_sec;
+    long tv_usec;
+};
+#define timeval __ms_timeval
+
 typedef struct
 {
     unsigned int fd_count;




More information about the wine-cvs mailing list