Use correct way of extracting timezone info

Patch by gnif

Ticket: #148
This commit is contained in:
Andreas Öman 2010-08-19 05:34:22 +00:00
parent ace8530a05
commit 7ad9ca9ef4
2 changed files with 6 additions and 3 deletions

View 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;
}

View 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':