Use folly/portability/GTest.h in folly/executurs/test/
[folly.git] / folly / portability / SysTime.h
index 56b572f27653d827dbbd3a51091bafd738c8394c..2b66dbdd377355d9ccb46370f597114ec33893de 100755 (executable)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <sys/time.h>
 #else
 // Someone decided this was a good place to define timeval.....
-#include <WinSock2.h>
+#include <folly/portability/Windows.h>
 struct timezone {
   int tz_minuteswest;
   int tz_dsttime;
 };
 
-extern "C" int gettimeofday(timeval* tv, timezone*);
+extern "C" {
+// Note that this needs to explicitly be `struct timezone` due to the fact that
+// the python 3 headers `#define timezone _timezone` on Windows. `_timezone` is
+// a global field that contains information on the current timezone. By
+// explicitly specifying that this is a `struct`, we ensure that it's treated as
+// a type, regardless of what name that type actually is :)
+// Note that this will break if `gettimeofday` ever becomes declared as anything
+// other than `extern "C"`, as the mangled name would be dependent on whether
+// python had been included before this header.
+int gettimeofday(timeval* tv, struct timezone*);
+void timeradd(timeval* a, timeval* b, timeval* res);
+void timersub(timeval* a, timeval* b, timeval* res);
+}
 #endif