浏览代码

Replaced unavailable include with struct definition for Xbox One

It appears this file was including winsock2.h just to get the timeval struct definition. There are platforms, such as Xbox One, that don't use winsock but do compile with _MSC_VER set, so just drop in the struct definition we needed instead of including all of winsock. This fixes compilation of this file for Xbox One. Without this change, there were numerous `timeval` complaints such as
```
1>c:\dev\protobuf\src\google\protobuf\util\time_util.h(153): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (compiling source file C:\dev\protobuf\src\google\protobuf\util\time_util.cc)
1>c:\dev\protobuf\src\google\protobuf\util\time_util.h(153): error C2143: syntax error: missing ',' before '&' (compiling source file C:\dev\protobuf\src\google\protobuf\util\time_util.cc)
```
etc.
Parnic 6 年之前
父节点
当前提交
3691c172c9
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/google/protobuf/util/time_util.h

+ 7 - 0
src/google/protobuf/util/time_util.h

@@ -37,7 +37,14 @@
 #include <ostream>
 #include <string>
 #ifdef _MSC_VER
+#ifdef _XBOX_ONE
+struct timeval {
+	long    tv_sec;         /* seconds */
+	long    tv_usec;        /* and microseconds */
+};
+#else
 #include <winsock2.h>
+#endif // _XBOX_ONE
 #else
 #include <sys/time.h>
 #endif