Merge pull request #9 from deflected/master

FreeBSD fixes
This commit is contained in:
rdb 2015-02-26 15:39:00 +01:00
commit 0e67fb7cf3
2 changed files with 7 additions and 1 deletions

View File

@ -60,7 +60,7 @@ extern char **environ;
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif
#if defined(IS_LINUX) || defined(IS_OSX) #if defined(IS_LINUX) || defined(IS_OSX) || defined(IS_FREEBSD)
// For link_map and dlinfo. // For link_map and dlinfo.
#include <link.h> #include <link.h>
#include <dlfcn.h> #include <dlfcn.h>

View File

@ -223,8 +223,14 @@ HTTPDate(const string &format) {
if (_time != (time_t)-1) { if (_time != (time_t)-1) {
// Unfortunately, mktime() assumes local time; convert this back // Unfortunately, mktime() assumes local time; convert this back
// to GMT. // to GMT.
#ifdef IS_FREEBSD
time_t now = time(NULL);
struct tm *tp = localtime(&now);
_time -= tp->tm_gmtoff;
#else /* IS_FREEBSD */
extern long int timezone; extern long int timezone;
_time -= timezone; _time -= timezone;
#endif /* IS_FREEBSD */
} }
#endif // __GNUC__ #endif // __GNUC__
} }