Boost logo

Boost :

From: Glen Knowles (gknowles_at_[hidden])
Date: 2002-04-23 16:53:15

> From: Mark Rodgers
> I think a date is just a date and its internal representation (be it
> since Jan 1 1970 or years since the beginning of time) is an
> detail.
> date d1 = date::today();
> Would give a date that represented today, and is completely calendar
> independent. Likewise
> date d2 = date::tomorrow();
> assert(d1 < d2);
> std::string s1 = gregorian::to_string(d1);
> std::string s2 = julian::to_string(d2);
> date d3 = gregorian::from_string("1 Jan 1970");
> Why do I need to know the internal representation of date?

In order for that to work you must define date to have a resolution equal to
the highest resolution of any date system, perhaps the day (second?) in this
example, and with a span large enough to cover all possible dates used by
any system. This doesn't meet the efficiency needs of many applications that
are quite happy with, for example, the unix time systems limited span of Jan
1 1970 to ~Jan 18 2038.

I agree that the internal representation is an implementation detail, but I
would say it is an implementation detail of the date system being used.

Boost list run by bdawes at, gregod at, cpdaniel at, john at