summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Penny <svnpenn@gmail.com>2015-05-24 09:42:13 -0500
committerNicolas Williams <nico@cryptonector.com>2015-05-25 02:05:07 -0500
commitff458803cee358f73f40bc1eda978b7a207f0bba (patch)
tree21569c8c65046214674ad877f42b3aa8ce27af7d
parent110e009996e1359d25b8e99e71f83b96e5870790 (diff)
Fix #793
-rw-r--r--builtin.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin.c b/builtin.c
index 640c6d79..745c9c51 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1,7 +1,11 @@
#define _BSD_SOURCE
#define _XOPEN_SOURCE
#include <sys/time.h>
-#include <alloca.h>
+#ifdef WIN32
+ #include <malloc.h>
+#else
+ #include <alloca.h>
+#endif
#include <assert.h>
#include <ctype.h>
#include <limits.h>
@@ -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;