summaryrefslogtreecommitdiff
path: root/sfeed_frames.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_frames.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_frames.c')
-rw-r--r--sfeed_frames.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sfeed_frames.c b/sfeed_frames.c
index 972f9ce..bb55c31 100644
--- a/sfeed_frames.c
+++ b/sfeed_frames.c
@@ -41,19 +41,19 @@ printfeed(FILE *fpitems, FILE *fpin, 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(fpitems, "%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(" ", fpitems);
+ }
f->total++;
- fprintf(fpitems, "%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=\"", fpitems);
xmlencode(fields[FieldLink], fpitems);