Boost logo

Boost :

From: mfdylan (dylan_at_[hidden])
Date: 2001-12-16 20:25:18


--- In boost_at_y..., "andreas_huber69" <andreas_at_h...> wrote:
> Hello there
>
> I'm really unhappy with the date/time handling facilities currently
> provided by the standard library.

I assure you it's not just you :o)

> class time:
> - Represents an absolute point in time.
> - The time of the day can be specified in hours, minutes, seconds
and
> nanoseconds.
> - The date can be specified with the Gregorian calendar, support
for
> other calendars can easily be added without modifying the time
class.
> - Any point in time from about 4000BC until about 50000 years in
the
> future can be represented.

class 'time' is not such a good name given that std::time is already
reserved and it would be nice to have something that had a chance of
making it into the standard sooner or later. 'date_time' is about
the only thing I can think of (event_time? time_point?)

One overriding problem: we do occasionally need to refer to points of
time billions of years in the past and in the future, and likewise
spans of time billions of years long (esp. in scientific
programming), but it's only a fairly small period for which we need
sub-second or even sub-day accuracy. Two possibilities:
a) templatize to allow accuracy/range tradeoffs, with
necessary "lossy" conversions.
b) determine some heuristic calculation that imbues certain time
periods with particular accuracies

The latter may be more convenient but hard to implement efficiently
and in a sensible manner. Less likely to be a real problem is the
fact that it would eventually become out of date, whereas the
templatized versions could allow picking a "point of reference", so
in 200 years everyone can still use the same C++ standard library
components ;o) (I wonder if the thought of C++ code still existing
in 200 years time seems as far-fetched to us as the thought of
Fortran code still existing in 40 years did to those in the 1960s...)

Dylan


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