|
Boost Users : |
From: Tobias Grimm (listaccount_at_[hidden])
Date: 2005-09-18 18:50:37
Hi,
Jeff Garland wrote:
>You are exactly right. For the base time information you should be able to do
>the following (I didn't test this)...
>
> time_facet* timefacet = new time_facet("%a, %d %b %Y %H:%M:%S");
>
>
Mmm... I even can't get this to compile.
date_test.cc:17: error: use of class template `template<class time_type,
class
CharT, class OutItrT> class boost::date_time::time_facet' as expression
That's my test case:
#include <cxxtest/TestSuite.h>
#include <sstream>
#include "boost/date_time/posix_time/posix_time.hpp"
#include "boost/date_time/time_facet.hpp"
using namespace boost::posix_time;
using namespace boost::date_time;
class DateTest: public CxxTest::TestSuite
{
public:
void TestConvert()
{
time_facet* timefacet = new time_facet("%a, %d %b %Y %H:%M:%S");
std::stringstream ss;
ss.str("Sat, 07 Sep 2002 00:00:01 GMT");
ss.imbue(std::locale(std::locale::classic(), timefacet));
ptime t;
ss >> t;
}
};
(Using version 1.32.0 with gcc 3.3.6)
>Probably a better approach would be to check out the spirit grammer for rfc822
>written by Peter Simons. Look for 'rfcdate' at
>
>
Thanks a millon! This looks interesting.
Regards,
Tobias
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