X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2Fportability%2FSysTime.h;h=2b66dbdd377355d9ccb46370f597114ec33893de;hb=7bf1486094cccb266e789a378d8e5f91e3cb7780;hp=162ff21ac132b82e7ecd918a6faeebdde1fa8f8b;hpb=3a152643ca8c0228102cce5de9ce60e8f974fe42;p=folly.git diff --git a/folly/portability/SysTime.h b/folly/portability/SysTime.h index 162ff21a..2b66dbdd 100755 --- a/folly/portability/SysTime.h +++ b/folly/portability/SysTime.h @@ -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. @@ -20,14 +20,22 @@ #include #else // Someone decided this was a good place to define timeval..... -#include +#include struct timezone { int tz_minuteswest; int tz_dsttime; }; 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); }