Boost logo

Boost :

Subject: Re: [boost] [locale] Review. Internationalization library?
From: Artyom (artyomtnk_at_[hidden])
Date: 2011-04-16 09:21:30


> > Why have you preferred to redo Boost.DateTime?
>
> If the DateTime library is redone, shouldn't it be released as a separated
>one, DateTime2?
>

No, because they have very different purposes.

There is almost no locale dependent libraries in Boost while
boost::locale::date_time
is strictly locale dependent.

It provides same interface for different calendars and they may be changed in
the runtime.

> > Do your classes preserve the same interface than Boost.DateTime?
>
> If not, does the documentation show the differences in a specific section?

Actually almost everything there is different:

  http://cppcms.sourceforge.net/boost_locale/html/dates_times_timezones.html

> If we follow the Chrono design, shouldn't the calendar be a template parameter
>of the dattime class?
>
> What about rewriting the following
>
> date_time some_point = period::year * 1995 + period::january + period::day*1;
>
> as
>
> date_time some_point = year(1995) + january + day(1);
>
> ?

Actually it may be good idea. I'm already thinking on improvement
of date_time API due to issues rise in the review and it seems that it
may be one of the approaches,

>
> Why your datatime class output by default as a number? Why there is no a
>default format?
>

Because date_time is approximately a number that represents a time point
in UTC (POSIX time) - seconds since Jan 1, 1970 GMT without leap seconds.

But it under the hood it allows to perform date-time calculations
according to current locale's rules.

It outputs number because "it is a number of seconds since..."
and the actual stream formatters are responsible to formatting
it.

It is covered by the links above.

Basically there is a separation of roles:

- date_time calculates times
- iostream formats numbers
- numeric representation connects between them.

> Best,
> Vicente

Thanks for the comments,
  Artyom


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