We rely on the include path to find many of these headers. It especially doesn't make sense to use #include "foo.h" for headers in the top-level include directory.
The timegm() function is non-standard but widely available. Provide an implementation for those systems that lack it. Bug #1006