Time library design proposal

Bayley, Alistair Alistair_Bayley at ldn.invesco.com
Wed Feb 2 09:44:31 EST 2005


[Oops, replied only to Ashley, not to list.]

> From: Ashley Yakeley [mailto:ashley at semantic.org] 
> 
> There's something to be said for representing date and time of day 
> separately in calendar time, something like this:
> 
>   data CalendarDate = CalendarDate ...
> 
>   data TimeOfDay = TimeOfDay ...
> 
>   data CalendarTime = CalendarTime
>   {
>     ctDate :: CalendarDate,
>     ctTime :: TimeOfDay
>   }
> 
> On the other hand, it adds two levels of construction to CalendarTime.


I'm not convinced. I think it would be simpler and just as functional to
have just a CalendarTime and a Duration. You would represent a time by a
Duration (i.e. time since midnight), and a day with no time component would
be represented by that date at midnight. You could add a Duration to a
CalendarTime to get a date-with-time.

Durations have other uses (differences between two CalendarTimes, summing
other Durations, etc), whereas a TimeOfDay is limited to a 24hr period.

Alistair.

-----------------------------------------
*****************************************************************
Confidentiality Note: The information contained in this   message, and any
attachments, may contain confidential   and/or privileged material. It is
intended solely for the   person(s) or entity to which it is addressed. Any
review,   retransmission, dissemination, or taking of any action in
reliance upon this information by persons or entities other   than the
intended recipient(s) is prohibited. If you received  this in error, please
contact the sender and delete the   material from any computer.
*****************************************************************



More information about the Libraries mailing list