From: Andreas Ă–man Date: Thu, 19 Aug 2010 05:34:22 +0000 (+0000) Subject: Use correct way of extracting timezone info X-Git-Tag: 2.12~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ad9ca9ef4f3d08f794934303282c952530c034a;p=thirdparty%2Ftvheadend.git Use correct way of extracting timezone info Patch by gnif Ticket: #148 --- diff --git a/src/htsp.c b/src/htsp.c index 2dc820b53..1ac89d94b 100644 --- a/src/htsp.c +++ b/src/htsp.c @@ -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; } diff --git a/src/main.c b/src/main.c index b66ce193e..055fdb4c1 100644 --- a/src/main.c +++ b/src/main.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -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':