From 24ac859a1f87affdba50468638823bfc52fae9a6 Mon Sep 17 00:00:00 2001 From: victor Date: Thu, 7 Jul 2005 03:49:28 +0000 Subject: RFC-1036 suggest the format "Wdy Mon DD HH:MM:SS YYYY". Make both format work. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2917 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- innbbsd/receive_article.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'innbbsd') diff --git a/innbbsd/receive_article.c b/innbbsd/receive_article.c index 2fc8edbf..92993aaf 100644 --- a/innbbsd/receive_article.c +++ b/innbbsd/receive_article.c @@ -350,8 +350,15 @@ receive_article() { struct tm tmbuf; - strptime(DATE, "%d %b %Y %X ", &tmbuf); - datevalue = timegm(&tmbuf); + /* RFC-1036 says the second format is the correct one. But we keep + * the first format for backward compatible. + */ + if (strptime(DATE, "%d %b %Y %X ", &tmbuf) != NULL) + datevalue = timegm(&tmbuf); + else if (strptime(DATE, "%a, %d %b %Y %X ", &tmbuf) != NULL) + datevalue = timegm(&tmbuf); + else + datevalue = -1; } if (datevalue > 0) { -- cgit v1.2.3