Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2005-05-28 09:39:38


On Sat, 28 May 2005 02:10:02 +0200, Paolo Coletta wrote
> I'm not sure if this is a bug or if I'm misusing the library. It
> seems that serializing boost::posix_time_ptime fails when using non-standard
> locale (Windows Xp OS - vc 7.1 compiler - boost updated from CVS few
> days ago).
>
> As an example, try adding
>
> std::locale::global( std::locale( "en" ) );
>
> as the first line of the testtime_serialize.cpp; this causes the
> test to fail when doing
>
> ia >> pt2;
>
> I tried to understand what was happening, and it seems to me that the
> problem is in keeping into account locale when serializing, while
> ignoring it while unserializing.
> In greg_serialize.hpp
> to_iso_string(d)
> may generate something like "2,0050527"; the method
> from_undelimited_string(ds)
> used to load the serialized date, expects a 4,2,2 format.

It looks like the problem is that the stream output is including a thousands
seperator when it shouldn't. The serialization should be 20050527 with no
number seperators. So it appears that we cannot depend on the stream not
using the thousands separtor in date_time/date_formatting.hpp (line 81) where
the year is actully output:

      std::basic_ostringstream<charT> ss;
      ss << ymd.year;

We'll look into fixing this...

Jeff


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