Browse Source

downloader: Correct lack of timezone

	- Use tm_gmtoff for GMT correction under FreeBSD

Signed-off-by: deflected <deflected@github>
deflected 10 years ago
parent
commit
d82f2c83cd
1 changed files with 6 additions and 0 deletions
  1. 6 0
      panda/src/downloader/httpDate.cxx

+ 6 - 0
panda/src/downloader/httpDate.cxx

@@ -223,8 +223,14 @@ HTTPDate(const string &format) {
   if (_time != (time_t)-1) {
     // Unfortunately, mktime() assumes local time; convert this back
     // 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;
     _time -= timezone;
+#endif /* IS_FREEBSD */
   }
 #endif  // __GNUC__
 }