From b722b45e5468af3e9405652b4ca57c10c376ba8b Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Sun, 5 Jul 2020 14:05:04 +0200 Subject: sfeed_atom: fix timezone, output if timestamp is set Timezone should be GMT (as intended), do not convert to localtime. --- sfeed_atom.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sfeed_atom.c b/sfeed_atom.c index 722a400..c5ea737 100644 --- a/sfeed_atom.c +++ b/sfeed_atom.c @@ -47,12 +47,6 @@ printfeed(FILE *fp, const char *feedname) line[--linelen] = '\0'; parseline(line, fields); - parsedtime = 0; - if (strtotime(fields[FieldUnixTimestamp], &parsedtime)) - continue; - if (!(tm = localtime(&parsedtime))) - err(1, "localtime"); - fputs("\n\t", stdout); if (feedname[0]) { fputs("[", stdout); @@ -78,9 +72,15 @@ printfeed(FILE *fp, const char *feedname) xmlencode(fields[FieldEnclosure], stdout); fputs("\" />\n", stdout); } - fprintf(stdout, "\t<updated>%04d-%02d-%02dT%02d:%02d:%02dZ</updated>\n", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); + + parsedtime = 0; + if (!strtotime(fields[FieldUnixTimestamp], &parsedtime) && + (tm = gmtime(&parsedtime))) { + fprintf(stdout, "\t<updated>%04d-%02d-%02dT%02d:%02d:%02dZ</updated>\n", + tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, + tm->tm_hour, tm->tm_min, tm->tm_sec); + } + if (fields[FieldAuthor][0]) { fputs("\t<author><name>", stdout); xmlencode(fields[FieldAuthor], stdout); -- cgit v1.2.3