]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Use correct way of extracting timezone info
authorAndreas Öman <andreas@lonelycoder.com>
Thu, 19 Aug 2010 05:34:22 +0000 (05:34 +0000)
committerAndreas Öman <andreas@lonelycoder.com>
Thu, 19 Aug 2010 05:34:22 +0000 (05:34 +0000)
Patch by gnif

Ticket: #148

src/htsp.c
src/main.c

index 2dc820b53a4841168cb000eb4e983aecb5f89605..1ac89d94b90245352b46e316e73d0255cdf9283a 100644 (file)
@@ -722,14 +722,13 @@ htsp_method_getSysTime(htsp_connection_t *htsp, htsmsg_t *in)
 {
   htsmsg_t *out;
   struct timeval tv;
-  struct timezone tz;
 
-  if(gettimeofday(&tv, &tz) == -1)
+  if(gettimeofday(&tv, NULL) == -1)
     return htsp_error("Unable to get system time"); 
 
   out = htsmsg_create_map();
   htsmsg_add_s32(out, "time", tv.tv_sec);
-  htsmsg_add_s32(out, "timezone", tz.tz_minuteswest);
+  htsmsg_add_s32(out, "timezone", timezone / 60);
   return out;
 }
 
index b66ce193e9c2c4fa940c9907d5d3637a14aaaf0b..055fdb4c119a6817f63d7c388f9cc2a14d18544e 100644 (file)
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <syslog.h>
 #include <limits.h>
+#include <time.h>
 
 #include <pwd.h>
 #include <grp.h>
@@ -242,6 +243,9 @@ main(int argc, char **argv)
   uint32_t adapter_mask = 0xffffffff;
   int crash = 0;
 
+  // make sure the timezone is set
+  tzset();
+
   while((c = getopt(argc, argv, "Aa:fu:g:c:Chdr:j:s")) != -1) {
     switch(c) {
     case 'a':