sfeed

Simple RSS and Atom feed parser
git clone https://git.sinitax.com/codemadness/sfeed
Log | Files | Refs | README | LICENSE | Upstream | sfeed.txt

commit f7c579c3b8e77215d60f1948367221b738823585
parent 903b740898a9828b1e5b2b0536455a68be3a4f41
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri,  7 Aug 2015 22:56:25 +0200

sfeed: set TZ=UTC at start, use mktime() not the deprecated timegm().

... timegm() is also -D_BSD_SOURCE.

Diffstat:
Msfeed.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/sfeed.c b/sfeed.c @@ -314,7 +314,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; @@ -718,6 +718,11 @@ main(int argc, char *argv[]) if (argc > 1) baseurl = argv[1]; + /* set time to UTC+0 for manual time conversion */ + if (setenv("TZ", "UTC", 1) == -1) + err(1, "setenv"); + tzset(); + /* init strings and initial memory pool size */ string_buffer_init(&ctx.item.timestamp, 64); string_buffer_init(&ctx.item.title, 256);