summaryrefslogtreecommitdiff
path: root/sfeed_html.c
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2020-07-05 15:57:02 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2020-07-05 15:57:02 +0200
commit276d5789fd91d1cbe84b7baee736dea28b1e04c0 (patch)
tree4d107bbcaa6272c10006f9ff45cfe06f8f7252c7 /sfeed_html.c
parenta13633a0a6b4e43d7809919ad70e085b9ecdff47 (diff)
format tools: don't skip items with a missing/invalid timestamp field
Handle it appropriately in the context of each format tool. Output the item but keep it blanked. NOTE: maybe in sfeed_twtxt it should use the current time instead?
Diffstat (limited to 'sfeed_html.c')
-rw-r--r--sfeed_html.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sfeed_html.c b/sfeed_html.c
index 97318af..42e6572 100644
--- a/sfeed_html.c
+++ b/sfeed_html.c
@@ -41,20 +41,20 @@ printfeed(FILE *fp, struct feed *f)
parseline(line, fields);
parsedtime = 0;
- if (strtotime(fields[FieldUnixTimestamp], &parsedtime))
- continue;
- if (!(tm = localtime(&parsedtime)))
- err(1, "localtime");
-
- isnew = (parsedtime >= comparetime) ? 1 : 0;
- totalnew += isnew;
- f->totalnew += isnew;
+ if (!strtotime(fields[FieldUnixTimestamp], &parsedtime) &&
+ (tm = localtime(&parsedtime))) {
+ isnew = (parsedtime >= comparetime) ? 1 : 0;
+ totalnew += isnew;
+ f->totalnew += isnew;
+
+ fprintf(stdout, "%04d-%02d-%02d&nbsp;%02d:%02d ",
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min);
+ } else {
+ fputs(" ", stdout);
+ }
f->total++;
- fprintf(stdout, "%04d-%02d-%02d&nbsp;%02d:%02d ",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min);
-
if (fields[FieldLink][0]) {
fputs("<a href=\"", stdout);
xmlencode(fields[FieldLink], stdout);