Upstreamed in 18f51bcf99101e5bf4c737239c44064227f34db8

ncurses 6.2 - patch 20200229

From 3737faf9325859a33d8288337c312fb9ad5b3e02 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <anonymous.maarten@gmail.com>
Date: Tue, 17 Mar 2020 15:24:34 +0100
Subject: [PATCH 02/15] Optionally include sys/time.h

---
 include/nc_mingw.h      | 2 ++
 ncurses/tty/lib_twait.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/nc_mingw.h b/include/nc_mingw.h
index 68a41849..b47bb2cf 100644
--- a/include/nc_mingw.h
+++ b/include/nc_mingw.h
@@ -52,10 +52,16 @@
 #undef gettimeofday
 #define gettimeofday(tv,tz) _nc_gettimeofday(tv,tz)
 
+#if HAVE_SYS_TIME_H
 #include <sys/time.h>		/* for struct timeval */
+#endif
 
+#ifdef _MSC_VER
+#include <winsock2.h>		/* for struct timeval */
+#endif
+
 extern int _nc_gettimeofday(struct timeval *, void *);
 
 #undef HAVE_GETTIMEOFDAY
 #define HAVE_GETTIMEOFDAY 1
 
diff --git a/ncurses/tty/lib_twait.c b/ncurses/tty/lib_twait.c
index 3ab168dd..74d267c7 100644
--- a/ncurses/tty/lib_twait.c
+++ b/ncurses/tty/lib_twait.c
@@ -71,7 +71,7 @@
 #  include <sys/select.h>
 # endif
 #endif
-#ifdef _WIN32
+#if HAVE_SYS_TIME_H
 #  include <sys/time.h>
 #endif
 #undef CUR
-- 
2.21.1

