From: Steven Penny Date: Sun, 24 May 2015 14:42:13 +0000 (-0500) Subject: Fix #793 X-Git-Tag: jq-1.5rc2~91 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ff458803cee358f73f40bc1eda978b7a207f0bba;p=jq Fix #793 --- diff --git a/builtin.c b/builtin.c index 640c6d7..745c9c5 100644 --- a/builtin.c +++ b/builtin.c @@ -1,7 +1,11 @@ #define _BSD_SOURCE #define _XOPEN_SOURCE #include -#include +#ifdef WIN32 + #include +#else + #include +#endif #include #include #include @@ -967,7 +971,7 @@ static time_t my_mktime(struct tm *tm) { #ifdef HAVE_TIMEGM return timegm(tm); #else /* HAVE_TIMEGM */ - time_t t = mktime(&tm); + time_t t = mktime(tm); if (t == (time_t)-1) return t; #ifdef HAVE_TM_TM_GMT_OFF @@ -1073,7 +1077,7 @@ static jv f_gmtime(jq_state *jq, jv a) { static jv f_gmtime(jq_state *jq, jv a) { if (jv_get_kind(a) != JV_KIND_NUMBER) return jv_invalid_with_msg(jv_string("gmtime requires numeric inputs")); - struct tm *tmp; + struct tm tm, *tmp; memset(&tm, 0, sizeof(tm)); double fsecs = jv_number_value(a); time_t secs = fsecs;