summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-10-02 17:27:50 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-10-02 17:27:50 +0200
commitc62d215e3456e32001cd58873d7d9f383db66525 (patch)
treeca65135997b16e4cb0bb8df26a7d74dd2ca14155
parent46c740508888a1ec6608fda78150401e70d051e8 (diff)
dont used deprecated timegm, use mktime with TZ set to UTC
this also makes it compile on NetBSD
-rw-r--r--sfeed.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sfeed.c b/sfeed.c
index a4c9098..993f2b2 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -1,7 +1,6 @@
#include <ctype.h>
#include <err.h>
#include <errno.h>
-#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -348,7 +347,7 @@ parsetime(const char *s, char *buf, size_t bufsiz, time_t *tp)
if (!(p = strptime(s, formats[i], &tm)))
continue;
tm.tm_isdst = -1; /* don't use DST */
- if ((t = timegm(&tm)) == -1) /* error */
+ if ((t = mktime(&tm)) == -1) /* error */
return -1;
if (gettimetz(p, tz, sizeof(tz), &tzoffset) == -1)
return -1;
@@ -714,6 +713,10 @@ main(int argc, char *argv[])
if (argc > 1)
baseurl = argv[1];
+ if (setenv("TZ", "UTC", 1) == -1)
+ err(1, "setenv");
+ tzset();
+
parser.xmlattr = xml_handler_attr;
parser.xmlattrend = xml_handler_attr_end;
parser.xmlattrstart = xml_handler_attr_start;