Overview
SHA1 Hash: | 484c8f9f860a0e1f9bf5feedbdb682dfb7a37d2c |
---|---|
Date: | 2009-12-08 18:43:51 |
User: | drh |
Comment: | Clean up the RSS code slightly. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/rss.c from [945efe289e] to [cc90868801].
@@ -26,27 +26,13 @@ #include "config.h" #include "rss.h" #include <assert.h> #include <time.h> -time_t rss_datetime_to_time_t(const char *dt){ - struct tm the_tm; - - the_tm.tm_year = atoi(dt)-1900; - the_tm.tm_mon = atoi(&dt[5])-1; - the_tm.tm_mday = atoi(&dt[8]); - the_tm.tm_hour = atoi(&dt[11]); - the_tm.tm_min = atoi(&dt[14]); - the_tm.tm_sec = atoi(&dt[17]); - - return mktime(&the_tm); -} - /* ** WEBPAGE: timeline.rss */ - void page_timeline_rss(void){ Stmt q; int nLine=0; char *zPubDate, *zProjectName, *zProjectDescr, *zFreeProjectName=0; Blob bSQL; @@ -53,11 +39,11 @@ const char *zType = PD("y","all"); /* Type of events. All if NULL */ const char zSQL1[] = @ SELECT @ blob.rid, @ uuid, - @ datetime(event.mtime), + @ event.mtime, @ coalesce(ecomment,comment), @ coalesce(euser,user), @ (SELECT count(*) FROM plink WHERE pid=blob.rid AND isprim), @ (SELECT count(*) FROM plink WHERE cid=blob.rid) @ FROM event, blob @@ -96,18 +82,20 @@ @ <generator>Fossil version %s(MANIFEST_VERSION) %s(MANIFEST_DATE)</generator> db_prepare(&q, blob_buffer(&bSQL)); blob_reset( &bSQL ); while( db_step(&q)==SQLITE_ROW && nLine<=20 ){ const char *zId = db_column_text(&q, 1); - const char *zDate = db_column_text(&q, 2); const char *zCom = db_column_text(&q, 3); const char *zAuthor = db_column_text(&q, 4); char *zPrefix = ""; + char *zDate; int nChild = db_column_int(&q, 5); int nParent = db_column_int(&q, 6); + time_t ts; - zDate = cgi_rfc822_datestamp(rss_datetime_to_time_t(zDate)); + ts = (time_t)((db_column_double(&q,2) - 2440587.5)*86400.0); + zDate = cgi_rfc822_datestamp(ts); if( nParent>1 && nChild>1 ){ zPrefix = "*MERGE/FORK* "; }else if( nParent>1 ){ zPrefix = "*MERGE* "; @@ -121,10 +109,11 @@ @ <description>%s(zPrefix)%s(zCom)</description> @ <pubDate>%s(zDate)</pubDate> @ <author>%s(zAuthor)</author> @ <guid>%s(g.zBaseURL)/ci/%s(zId)</guid> @ </item> + free(zDate); nLine++; } db_finalize(&q); @ </channel>