Boost logo

Boost :

From: Jeff Garland (jeff_at_[hidden])
Date: 2002-12-10 11:19:29


> > In general, based on review comments, the library has moved to
> > using iostreams with facets for doing I/O since this takes into
> > account the issues of localization and wide characters. There
> > was controversy about whether string conversion should even
> > be part of the library with some suggesting it should be removed
> > in favor of streaming -- which of course can provide conversions
> > to strings. I decided to leave it there because some older but
> > heavily used compilers (gcc 2.95.x, MSVC 6.5) have issues with
> > support for localized I/O which the stream-based solution uses.
>
> What problems are there with MSVC 6.5? I'm now all ready to go with

I don't remember the details, just that I couldn't get the std::locale
stuff working. It works fine with VC7 so that was enough for me to
just #ifdef it out for VC6.

> streaming, but the MSVC6.5 warning disturbs me a little. How about
> MSVC6.5 + STLPort?

Haven't tried it with STLPort. The whole thing is controlled
by a macro in locale_config.hpp so you can try it out if you
want.
 
> Dates use a locale facet quite well. Time does not. Using the expression
> "stream << time", does not get you an output depending on the stream's
> locale's definition for hour separator, minute separator. Some base work
> is done in iso_format.hpp, but I see no use anywhere in the library
> (using a file search) of iso_format.hpp's fractional_time_sep_char() for
> example. I see no way to set whether .000 is outputed when the fractional
> part of the seconds is 0. Maybe I'm missing something here.

Unfortunately, you are not missing anything. There isn't a locale setting
for time -- it needs to be added. I was also thinking of some I/O
manipulators to control this as well.

> Other comments: I see no way to retrieve easily the number of
> milliseconds from a duration. I can only extract the "fractional
> seconds" which depends on the platform I compile on, as far as I can
> tell, and does not seem to me to lend itself to portability. There is no

All the platforms are currently using nanoseconds for the default or
milliseconds by option. However, you can do this portably by
inspecting the posix_time_duration::rep_type (sorry about the name
it should have been resolution_traits). It provides the
time_resolution_traits. The res_adjust method of the traits
will provide you with the number of 'fractional second ticks'
in one second. Based on that you can calculate the millisecond
count within the time_duration.

> millisecond_clock or anything more precise beyond second_clock(), while
> I suppose most platforms would be able to provide such a thing (although
> in system specific ways), and probably even higher resolutions. While I
> can write such a thing, what the library provides seems to constrain me to
> what C provides only. On that note, I suppose something similar can be

I have a 'not quite ready' for prime time version of exactly this. I'm
too busy to finalize it at the moment, but I can post it for you if you
want to work on it.

> said for writing a facet. It seems that there is no ready-made facet to
> use for this, and the user has to provide his own, giving arrays of all
> the day names etc.

Well the facet's are a relatively recent addition to the library.
I'd be happy to provide a standard set of these, but I would like
users to contribute and review them as I'm not a localization
expert.

> week_number does not seem to take into account localization variations,
> that seem to exist, such as whether Sunday or Monday is the first day of
> the week. I'd also like to have the ability to specify the minimum number
> of days in the week.
>
> I think it's a good library, but it's lacking many things that would make
> it easier to use, or at least, I didn't find many things after looking
> through the sources for several hours trying to understand it. Most of
> these things are things I need, so I feel I'd need to do them anyway, if
> they are not there already.

I certainly recognize there are additional desires. Since the library
has been release publically, I have pretty much let user requests
focus my efforts -- which are naturally limited by the time I have
available. If there are things you really need and have a desire
to write some of the code, please contact me offline
(jeff_at_[hidden]). I'd be more than happy to work
with you on adding some of the things you want.

Jeff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk