fix wxDateTime::ParseRfc822Date() to handle missing seconds (ticket #1341)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53900 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2008-06-01 14:37:26 +00:00
parent 9aa7bedbb5
commit cf9f673789
2 changed files with 18 additions and 3 deletions

View File

@ -2847,8 +2847,9 @@ wxDateTime::ParseRfc822Date(const wxString& date, wxString::const_iterator *end)
min = (wxDateTime_t)(min + *p++ - _T('0'));
wxDateTime_t sec = 0;
if ( *p++ == _T(':') )
if ( *p == _T(':') )
{
p++;
if ( !wxIsdigit(*p) )
{
return NULL;

View File

@ -767,15 +767,29 @@ void DateTimeTestCase::TestParceRFC822()
},
{
"Sun, 28 Aug 2005 03:31:30 +0200",
{ 28, wxDateTime::Aug, 2005, 1, 31, 30 },
{ 28, wxDateTime::Aug, 2005, 1, 31, 30 },
true
},
{
"Sat, 18 Dec 1999 10:48:30 -0500",
{ 18, wxDateTime::Dec, 1999, 15, 48, 30 },
{ 18, wxDateTime::Dec, 1999, 15, 48, 30 },
true
},
// seconds are optional according to the RFC
{
"Sun, 01 Jun 2008 16:30 +0200",
{ 1, wxDateTime::Jun, 2008, 14, 30, 00 },
true
},
// try some bogus ones too
{
"Sun, 01 Jun 2008 16:30: +0200",
{ 0 },
false
},
};
for ( unsigned n = 0; n < WXSIZEOF(parseTestDates); n++ )