about summary refs log tree commit diff
path: root/absl/time/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/time/time.h')
-rw-r--r--absl/time/time.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/absl/time/time.h b/absl/time/time.h
index 594396c751df..0534780516d0 100644
--- a/absl/time/time.h
+++ b/absl/time/time.h
@@ -65,7 +65,14 @@
 #if !defined(_MSC_VER)
 #include <sys/time.h>
 #else
-#include <winsock2.h>
+// We don't include `winsock2.h` because it drags in `windows.h` and friends,
+// and they define conflicting macros like OPAQUE, ERROR, and more. This has the
+// potential to break Abseil users.
+//
+// Instead we only forward declare `timeval` and require Windows users include
+// `winsock2.h` themselves. This is both inconsistent and troublesome, but so is
+// including 'windows.h' so we are picking the lesser of two evils here.
+struct timeval;
 #endif
 #include <chrono>  // NOLINT(build/c++11)
 #include <cmath>