Menu

#2 conversion to "struct tm"

closed
nobody
None
5
2008-05-17
2006-06-04
Anonymous
No

Conversion from XmlRpcValue to "struct tm" seems
incorrect, suggesting this correction:

bool XmlRpcValue::timeFromXml(std::string const&
valueXml, int* offset)
{
size_t valueEnd = valueXml.find('<', *offset);
if (valueEnd == std::string::npos)
return false; // No end tag;

std::string stime = valueXml.substr(*offset,
valueEnd-*offset);

struct tm t;
if
(sscanf(stime.c_str(),"%4d%2d%2dT%2d:%2d:%2d",&t.tm_year,&t.tm_mon,&t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec)
!= 6)
return false;

t.tm_year -= 1900; // dw : tm_year starts at 1900
t.tm_mon -= 1; // dw : tm_mon start at 0

dwazir@free.fr

Discussion

  • Chris Morley

    Chris Morley - 2008-05-17

    Logged In: YES
    user_id=42402
    Originator: NO

    Fixed in cvs

     
  • Chris Morley

    Chris Morley - 2008-05-17
    • status: open --> closed
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.