Boost logo

Boost Users :

From: Serge Skorokhodov (serge.skorokhodov_at_[hidden])
Date: 2005-07-15 12:46:49


Hi,

I've built todays cvs boost library but date_time lib seems to have the
same error as in 1.32 version. That is:

    wstring wts = _T("20021017T231217.12345");
    wdate_facet* date_facet = new wdate_facet;
    wtime_facet* time_facet = new wtime_facet;
    ptime pt1(
        from_iso_string(
            convert_string_type<_TCHAR, char>(wts)
        )
    );
    long Y = pt1.date().year();
    long M = pt1.date().month();
    long d = pt1.date().day();
    long h = pt1.time_of_day().hours();
    long m = pt1.time_of_day().minutes();
    long s = pt1.time_of_day().seconds();
    long f = pt1.time_of_day().fractional_seconds();
    wcout << L"Components of pt1:" << endl
        << L"Year: " << Y << endl
        << L"Month: " << M << endl
        << L"Day: " << d << endl
        << L"Hours: " << h << endl
        << L"Minutes: " << m << endl
        << L"Seconds: " << s << endl
        << L"Microseconds: " << f << endl;
    ptime pt2(
        gregorian::date(2002, 10, 17),
        posix_time::time_duration(23, 12, 17, 12345)
    );
    wcout << pt2 << endl;
    Y = pt2.date().year();
    M = pt2.date().month();
    d = pt2.date().day();
    h = pt2.time_of_day().hours();
    m = pt2.time_of_day().minutes();
    s = pt2.time_of_day().seconds();
    f = pt2.time_of_day().fractional_seconds();
    wcout << L"Components of pt2:" << endl
        << L"Year: " << Y << endl
        << L"Month: " << M << endl
        << L"Day: " << d << endl
        << L"Hours: " << h << endl
        << L"Minutes: " << m << endl
        << L"Seconds: " << s << endl
        << L"Microseconds: " << f << endl;

Output is:

Components of pt1:
Year: 2002
Month: 10
Day: 17
Hours: 23
Minutes: 12
Seconds: 17
Microseconds: 0
2002-Oct-17 23:12:17.012345
Components of pt2:
Year: 2002
Month: 10
Day: 17
Hours: 23
Minutes: 12
Seconds: 17
Microseconds: 12345

Another question is about wide char support. As far as I understand,
wstring is supported only through stringstream and facets?

TIA

-- 
Serge

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net