diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-07 11:49:28 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-07 11:49:28 +0800 |
commit | 24ac859a1f87affdba50468638823bfc52fae9a6 (patch) | |
tree | df0d7aae1441aaebf409a1772a883d56cf43bcad | |
parent | d898d4442cdba7888997640a7e1271b192d73341 (diff) | |
download | pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.tar pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.tar.gz pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.tar.bz2 pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.tar.lz pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.tar.xz pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.tar.zst pttbbs-24ac859a1f87affdba50468638823bfc52fae9a6.zip |
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
-rw-r--r-- | innbbsd/receive_article.c | 11 |
1 files changed, 9 insertions, 2 deletions
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) { |