Public Member Functions | Public Attributes

XMLRPC::ISODate Struct Reference

#include <xmlrpc.h>

Collaboration diagram for XMLRPC::ISODate:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ISODate ()
 ISODate (const char *s)
string str () const
long diff (const ISODate &other) const

Public Attributes

int _year
int _month
int _day
int _hour
int _minute
int _second

Detailed Description

Definition at line 162 of file xmlrpc.h.


Constructor & Destructor Documentation

XMLRPC::ISODate::ISODate (  )

Definition at line 47 of file xmlrpc.cpp.

References _day, _hour, _minute, _month, _second, and _year.

{
#ifdef _WIN32
    SYSTEMTIME time;

    GetLocalTime(&time);

    _year = time.wYear;
    _month = time.wMonth;
    _day  = time.wDay;

    _hour = time.wHour;
    _minute = time.wMinute;
    _second = time.wSecond;
#else
    time_t t;
    struct tm lc;

    time(&t);
    localtime_r(&t, &lc);

    _year = lc.tm_year + 1900;
    _month = lc.tm_mon + 1;
    _day = lc.tm_mday;

    _hour = lc.tm_hour;
    _minute = lc.tm_min;
    _second = lc.tm_sec;
#endif
}
XMLRPC::ISODate::ISODate ( const char *  s )

Definition at line 78 of file xmlrpc.cpp.

References _day, _hour, _minute, _month, _second, _year, and sscanf_s.

{
    if (sscanf_s(str, "%04d%02d%02dT%02d:%02d:%02d", &_year, &_month, &_day, &_hour, &_minute, &_second) != 6)
        throw Exception("invalid date format");
}

Member Function Documentation

long XMLRPC::ISODate::diff ( const ISODate other ) const

Definition at line 142 of file xmlrpc.cpp.

References XMLRPC::get_time_t().

{
    time_t t1 = get_time_t(*this);
    time_t t2 = get_time_t(other);

    return (long) difftime(t1, t2);
}

Here is the call graph for this function:

string XMLRPC::ISODate::str (  ) const

Definition at line 84 of file xmlrpc.cpp.

References _day, _hour, _minute, _month, _second, and _year.

Referenced by XMLRPC::XMLRPCCall::operator%(), and XMLRPC::XMLRPCResponse::set_date().

{
    char buffer[18];

    sprintf(buffer, "%04d%02d%02dT%02d:%02d:%02d", _year, _month, _day, _hour, _minute, _second);

    return buffer;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 172 of file xmlrpc.h.

Referenced by XMLRPC::get_time_t(), ISODate(), and str().

Definition at line 174 of file xmlrpc.h.

Referenced by XMLRPC::get_time_t(), ISODate(), and str().

Definition at line 175 of file xmlrpc.h.

Referenced by XMLRPC::get_time_t(), ISODate(), and str().

Definition at line 171 of file xmlrpc.h.

Referenced by XMLRPC::get_time_t(), ISODate(), and str().

Definition at line 176 of file xmlrpc.h.

Referenced by XMLRPC::get_time_t(), ISODate(), and str().

Definition at line 170 of file xmlrpc.h.

Referenced by XMLRPC::get_time_t(), ISODate(), and str().


The documentation for this struct was generated from the following files: