Explicitly specify that timezone is a struct
[folly.git] / folly / portability / SysTime.h
index ef0293e9e9d854ad0a85830ff8cd788b07199dc3..2b66dbdd377355d9ccb46370f597114ec33893de 100755 (executable)
@@ -27,7 +27,15 @@ struct timezone {
 };
 
 extern "C" {
-int gettimeofday(timeval* tv, timezone*);
+// 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);
 }