Time library discussion (reprise)

Juanma Barranquero lektu at terra.es
Wed Nov 12 00:43:28 EST 2003

On Tue, 11 Nov 2003 13:34:16 -0000, "Simon Marlow" <simonmar at microsoft.com> wrote:

> Let's talk in concrete terms.  Could you propose an API for what you
> have in mind for the basic UTC functionality?

I'm not knowledgeable enough in Haskell to be able to propose a sensible
API, but still..

> although it will be able to do larger scale calendar
> calculations (i.e. adding days, months, etc.).  Or maybe you provide the
> second-level calculations but document that they don't take into account
> leap seconds?

...that's the idea. A simple Calendar class with instances UTC,
Gregorian/ISO, JD and/or MJD perhaps. Simple operations to add and
substract periods, compare dates/times, convert between them, ask for
miscellaneous info (leap year, day of week, etc.); with support for
timezones (offsets from UTC) of course. That's all I've ever needed from
a datetime library.

As Peter Simmons has said, there are several libraries available for
other languages which already implement a sensible set of operations for
dates (boost has a good example). We should just borrow from them.


More information about the Libraries mailing list