Boost logo

Boost :

From: Ross Smith (r-smith_at_[hidden])
Date: 2002-04-17 02:10:27


Darin Adler wrote:
>
> The formal review period for Jeff Garland's date and time library begins
> today and runs through Wednesday, April 24.
>
> The best way to find the library for review is to start at the Boost
> Wiki GDTL start page <http://www.crystalclearsoftware.com/cgi-
> bin/boost_wiki/wiki.pl?GDTL>.
>
> The date and time library submission includes functions for working with
> the Gregorian date system and the POSIX time system. Please review the
> library and post your comments to the boost mailing list.
>
> Be sure to say in your comments whether or not you think the library
> should be accepted by Boost.

I vote NO.

The library suffers from a fundamental design flaw: it doesn't separate
the concepts of "time" and "calendar". Time intervals and points in time
are natural physical quantities that should be manipulated independently
of the units we choose to measure them with. The approach taken by the
"GDTL" (I don't think there's anything "generic" about it) would lead to
an explosion of mutually incompatible sub-libraries for every calendar
anybody wanted to use.

A date/time library should have types representing "point in time" and
"time interval"; these would be opaque, with operations for arithmetic
on them but no intrinsic connection with any kind of human calendar.
Then you can add "calendar" types that represent a broken down time
represented in a specific calendar. The calendar types would have no
arithmetic properties themselves; they exist only to handle the
conversion between the opaque time types and calendar-specific
representations.

(Thinking about this a bit further ... there would be three orthogonal
elements to a calendar type, probably supplied as template arguments:
the basic calendar system (e.g. Gregorian vs Julian), the underlying
astronomical time scale (e.g. UTC vs TAI; to put it another way, the
definition of the relationship between seconds and days), and the time
zone + DST rules.)

Building Eurocentric assumptions into the language is exactly what the
likes of Unicode and C++'s locale system have been developed to get rid
of. I strongly believe that any proposal that doesn't separate the real
physical concepts and their culture-specific representations into
orthogonal components should be automatically rejected.

On a tangential note, I also suggest that the concept labelled "time
period" in the GDTL doesn't belong in a time library. It's a generic
concept that would be better modelled as a template that can be
instantiated on arithmetic types.

-- 
Ross Smith ...................................... Auckland, New Zealand
r-smith_at_[hidden] ....................................................
  "We need a new cosmology. New gods. New sacraments. Another drink."
                                                       -- Patti Smith

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