folly::Init, RAII variant of folly::init
[folly.git] / folly / portability / SysTime.h
index a2c32e31317eb3be1b4aca23d47850da891bd0fd..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.
@@ -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);
 }