incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Brown <mbr...@inbox.com>
Subject RE: expectation vs requirements for locale facets
Date Sun, 19 Aug 2007 21:13:39 GMT
Hi Travis,

In my experience, the time_get facet isn't always able to reliably parse international times
and cannot parse every time string produced by the time_put facet. I don't remember ever having
problems with spaces though. On Linux at least, stdcxx has no problems skipping leading space
in time strings. Which locale and what operating system does it not do so for you?

-- Mark


> -----Original Message-----
> From: tvitek@quovadx.com
> Sent: Sun, 19 Aug 2007 00:09:01 -0600
> To: stdcxx-dev@incubator.apache.org
> Subject: expectation vs requirements for locale facets
> 
> 
> So I've got myself stuck a little bit, and I'm hoping to get some
> direction. The 22.locale.time.get.mt test that I'm writing currently has
> some problems. In the test I generate date/time strings like this...
> 
>     switch (data.type_) {
>     case MyTimeData::get_time:
>         *np.put (std::ostreambuf_iterator<char>(&nsb),
>                  nio, ' ', &data.time_, 'X') = '\0';
>         break;
> 
> In the test threads, I attempt to read the data back like this...
> 
>     switch (data.type_) {
>     case MyTimeData::get_time:
>         ng.get_time (std::istreambuf_iterator<char>(&nsb),
>                      std::istreambuf_iterator<char>(), nio,
>                      state, &local);
>         RW_ASSERT (local.tm_hour == data.time_.tm_hour);
>         RW_ASSERT (local.tm_min == data.time_.tm_min);
>         RW_ASSERT (local.tm_sec == data.time_.tm_sec);
>         break;
> 
> The problem is that some locales pad their date/time output with
> whitespace [like '7. 6. 1988' or ' 7.6.1988'] and I'm unable to use
> num_get<>::get_[time,date] to read what is written by num_put<>::put. It
> is my understanding that I should be able to do so. Is this a bug, a
> known issue, or is it acceptable behavior that I need to code around in
> the test?
> 
> Travis

____________________________________________________________
FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
Check it out at http://www.inbox.com/earth

Mime
View raw message