shithub: rssfill

Download patch

ref: 2d294ab079a4fbdb60bf38dd97064f7c07aed3b6
parent: d2e6790b3ff30aaa4a3a91e80334548155219d81
author: sirjofri <sirjofri@sirjofri.de>
date: Thu Jun 11 11:09:37 EDT 2020

changes date parsing to new libdate (man tmdate)

these changes will be merged when the new libdate is officially commited.

--- a/rssfill.c
+++ b/rssfill.c
@@ -27,6 +27,7 @@
 	int fd;
 	char file[1024];
 	long d;
+	Tm t;
 	Dir dir;
 	
 	if(f != nil){
@@ -35,7 +36,15 @@
 
 		while(f != nil){
 			if(f->s == 2){
-				d = parsedate(f->date);
+				if(tmparse(&t, "W[,] ?D MMM YYYY hh:mm:ss ?Z", f->date, nil) == nil)
+					if(tmparse(&t, "YYYY-MM-DD[T]hh:mm:ss?Z", f->date, nil) == nil)
+						if(tmparse(&t, nil, f->date, nil) == nil)
+							sysfatal("tmparse: %r");
+						else
+							fprint(2, "tmparse: auto parsed date\n");
+				
+				d = t.abs;
+				
 				snprint(file, 1023, "%s/%s%ld", directory, prefix, d);
 				
 				fd = create(file, OWRITE, 0666);