summaryrefslogtreecommitdiff
path: root/sfeed_twtxt.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_twtxt.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_twtxt.c')
-rw-r--r--sfeed_twtxt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sfeed_twtxt.c b/sfeed_twtxt.c
index 52281d2..2b171ba 100644
--- a/sfeed_twtxt.c
+++ b/sfeed_twtxt.c
@@ -24,14 +24,14 @@ printfeed(FILE *fp, const char *feedname)
parseline(line, fields);
parsedtime = 0;
- if (strtotime(fields[FieldUnixTimestamp], &parsedtime))
- continue;
- if (!(tm = gmtime(&parsedtime)))
- err(1, "gmtime");
-
- fprintf(stdout, "%04d-%02d-%02dT%02d:%02d:%02dZ\t",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min, tm->tm_sec);
+ if (!strtotime(fields[FieldUnixTimestamp], &parsedtime) &&
+ (tm = gmtime(&parsedtime))) {
+ fprintf(stdout, "%04d-%02d-%02dT%02d:%02d:%02dZ\t",
+ tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ tm->tm_hour, tm->tm_min, tm->tm_sec);
+ } else {
+ fputs("\t", stdout);
+ }
if (feedname[0])
printf("[%s] ", feedname);
fputs(fields[FieldTitle], stdout);